@onlyworlds/sdk 4.23.0 → 4.24.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/CHANGELOG.md +19 -0
- package/README.md +12 -1
- package/dist/index.d.ts +75 -14
- package/dist/index.js +50 -7
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,25 @@ earlier history lives in git log only.
|
|
|
5
5
|
|
|
6
6
|
## [Unreleased]
|
|
7
7
|
|
|
8
|
+
## [4.24.0] — 2026-10-15
|
|
9
|
+
|
|
10
|
+
### Added
|
|
11
|
+
- **A world's invite links** (keel C1, 48c10d4), on the owner's account token (`ow_a_`):
|
|
12
|
+
`createWorldLink(worldId, { reader, role?, days?, inviterName?, withCharacter? })` answers the
|
|
13
|
+
new link with its `code`, `link` and the one `line` to send (the code is in this answer only:
|
|
14
|
+
keel keeps a hash); `listWorldLinks(worldId)` the links without codes, each with its `status`
|
|
15
|
+
and `uses`; `revokeWorldLink(worldId, linkId)`. Types `OwWorldLink`, `OwCreatedWorldLink`. A
|
|
16
|
+
non-owner, and a world that doesn't exist, get 404; a world key is a TypeError before sending.
|
|
17
|
+
For Lantern's Invite someone (Temper, h29 #5152).
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
- `acceptJoin`'s doc comment and the README: accepting needs no account PIN for any role (keel
|
|
21
|
+
#297, ed73c90), so its refusals are 404 and 409 `already_member`; `pin_required` now belongs to
|
|
22
|
+
minting a write key for the membership. `isPinRequired` stays.
|
|
23
|
+
- Doc comments say "token rating" for the account's daily budget (`ask`, `sort`, `allowance`,
|
|
24
|
+
`OwAllowance`, the answers' `token_rating`), as the README did in 4.23.0; the docs site's
|
|
25
|
+
generated reference reads them. No code change.
|
|
26
|
+
|
|
8
27
|
## [4.23.0] — 2026-10-14
|
|
9
28
|
|
|
10
29
|
### Deprecated
|
package/README.md
CHANGED
|
@@ -119,7 +119,18 @@ const invite = await client.previewJoin(code); // who invites, which world, wh
|
|
|
119
119
|
const membership = await account.acceptJoin(code); // account = a client with an ow_a_ token
|
|
120
120
|
```
|
|
121
121
|
|
|
122
|
-
A bad code (unknown, used, revoked, expired) is one 404 (`err.isNotFound`). Accepting can answer `err.isAlreadyMember
|
|
122
|
+
A bad code (unknown, used, revoked, expired) is one 404 (`err.isNotFound`). Accepting can answer `err.isAlreadyMember`; it needs no account PIN, though a write key for the new membership waits for one. A refusal never uses up the code.
|
|
123
|
+
|
|
124
|
+
The owner makes, lists and revokes the links with the account token (since 4.24.0). The code comes back once, in the answer that makes it:
|
|
125
|
+
|
|
126
|
+
```typescript
|
|
127
|
+
const made = await account.createWorldLink(worldId, { reader: 'person', role: 'contributor', days: 7 });
|
|
128
|
+
// made.line: the one line to send (who invites, to which world, the link); made.code: the ow_j_ code
|
|
129
|
+
const links = await account.listWorldLinks(worldId); // no codes: status pending | used | revoked | expired
|
|
130
|
+
await account.revokeWorldLink(worldId, made.id);
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
`reader: 'agent'` makes a link an AI agent redeems for a seat instead. Anyone but the owner gets a 404.
|
|
123
134
|
|
|
124
135
|
Once in, a world key can ask who it is and who else is there (since 4.22.0):
|
|
125
136
|
|
package/dist/index.d.ts
CHANGED
|
@@ -2014,7 +2014,7 @@ interface OwAskAnswer {
|
|
|
2014
2014
|
remaining: number;
|
|
2015
2015
|
/** The account's tokens left today after this call (since keel a6244db, 2026-10-14). */
|
|
2016
2016
|
tokens_remaining: number;
|
|
2017
|
-
/** The account's daily
|
|
2017
|
+
/** The account's token rating: its daily budget in tokens, one meter with the Council (since keel a6244db). */
|
|
2018
2018
|
token_rating: number;
|
|
2019
2019
|
[k: string]: unknown;
|
|
2020
2020
|
}
|
|
@@ -2096,11 +2096,11 @@ interface OwSortAnswer {
|
|
|
2096
2096
|
output_tokens: number;
|
|
2097
2097
|
};
|
|
2098
2098
|
/** How many more calls of this one's size fit in what the account has left today; ask and
|
|
2099
|
-
* sort spend from one
|
|
2099
|
+
* sort spend from one token rating. */
|
|
2100
2100
|
remaining: number;
|
|
2101
2101
|
/** The account's tokens left today after this call (since keel a6244db, 2026-10-14). */
|
|
2102
2102
|
tokens_remaining: number;
|
|
2103
|
-
/** The account's daily
|
|
2103
|
+
/** The account's token rating: its daily budget in tokens, one meter with the Council (since keel a6244db). */
|
|
2104
2104
|
token_rating: number;
|
|
2105
2105
|
[k: string]: unknown;
|
|
2106
2106
|
}
|
|
@@ -2135,15 +2135,15 @@ interface OwMember {
|
|
|
2135
2135
|
name?: string;
|
|
2136
2136
|
[k: string]: unknown;
|
|
2137
2137
|
}
|
|
2138
|
-
/** GET /account/allowance: the account's
|
|
2138
|
+
/** GET /account/allowance: the account's token rating and what is left of it today (keel 872431f, 2026-10-14). */
|
|
2139
2139
|
interface OwAllowance {
|
|
2140
|
-
/** The account's daily
|
|
2140
|
+
/** The account's token rating: its daily budget in tokens. */
|
|
2141
2141
|
token_rating: number;
|
|
2142
2142
|
/** Tokens spent today (UTC); may pass the rating by the size of the last call. */
|
|
2143
2143
|
tokens_used_today: number;
|
|
2144
2144
|
/** Tokens left today, never below 0. */
|
|
2145
2145
|
tokens_remaining: number;
|
|
2146
|
-
/** When the
|
|
2146
|
+
/** When the day's tokens reset: the next midnight UTC (ISO 8601). */
|
|
2147
2147
|
resets_at: string;
|
|
2148
2148
|
[k: string]: unknown;
|
|
2149
2149
|
}
|
|
@@ -2166,6 +2166,39 @@ interface OwJoinPreview {
|
|
|
2166
2166
|
expires_at: string;
|
|
2167
2167
|
[k: string]: unknown;
|
|
2168
2168
|
}
|
|
2169
|
+
/** One of a world's invite links, as GET /account/worlds/{id}/links lists it (keel C1, 48c10d4). */
|
|
2170
|
+
interface OwWorldLink {
|
|
2171
|
+
/** The link's id: revokeWorldLink takes it. */
|
|
2172
|
+
id: string;
|
|
2173
|
+
/** `person`: accepted signed in, with acceptJoin. `agent`: redeemed by an AI agent at POST /join. */
|
|
2174
|
+
reader: 'person' | 'agent';
|
|
2175
|
+
role: OwMemberRole;
|
|
2176
|
+
/** The name the owner gave an agent link on the website, or empty. */
|
|
2177
|
+
label: string;
|
|
2178
|
+
/** The name the link is signed with, or empty (the invite line then reads "Someone"). */
|
|
2179
|
+
inviter_name: string;
|
|
2180
|
+
/** Whether redeeming gives the agent a Character of its own. Always false on a person link. */
|
|
2181
|
+
with_character: boolean;
|
|
2182
|
+
/** The code's last four characters, to tell links apart. */
|
|
2183
|
+
last4: string;
|
|
2184
|
+
/** ISO 8601, UTC. */
|
|
2185
|
+
created_at: string;
|
|
2186
|
+
/** ISO 8601, UTC. */
|
|
2187
|
+
expires_at: string;
|
|
2188
|
+
/** 0 or 1: a link works once. */
|
|
2189
|
+
uses: number;
|
|
2190
|
+
status: 'pending' | 'used' | 'revoked' | 'expired';
|
|
2191
|
+
[k: string]: unknown;
|
|
2192
|
+
}
|
|
2193
|
+
/** POST /account/worlds/{id}/links: the new link, with its code. The code is in this answer only: keel keeps a hash. */
|
|
2194
|
+
interface OwCreatedWorldLink extends OwWorldLink {
|
|
2195
|
+
/** The `ow_j_` join code. Shown once; it can never be read again. */
|
|
2196
|
+
code: string;
|
|
2197
|
+
/** The invite link: the /join page with the code after `#`. */
|
|
2198
|
+
link: string;
|
|
2199
|
+
/** The one line to send: who invites, to which world, and the link. */
|
|
2200
|
+
line: string;
|
|
2201
|
+
}
|
|
2169
2202
|
/** POST /account/join: the new membership (the same row as accepting an email invite). */
|
|
2170
2203
|
interface OwJoinedMembership {
|
|
2171
2204
|
/** The membership's id. */
|
|
@@ -2612,18 +2645,46 @@ declare class OwV2Client {
|
|
|
2612
2645
|
/**
|
|
2613
2646
|
* POST /account/join -- accept an invite link's code as the account this client's
|
|
2614
2647
|
* `ow_a_` token belongs to: 201 with the new membership. Refusals: 404 `not_found`
|
|
2615
|
-
* (every bad code, and a code made for an AI agent)
|
|
2616
|
-
* (`err.isAlreadyMember`)
|
|
2617
|
-
*
|
|
2618
|
-
* before anything is sent.
|
|
2648
|
+
* (every bad code, and a code made for an AI agent) and 409 `already_member`
|
|
2649
|
+
* (`err.isAlreadyMember`). Accepting needs no account PIN, for any role (keel #297,
|
|
2650
|
+
* ed73c90); a write key for the membership waits for one (`pin_required`). A refusal
|
|
2651
|
+
* never spends the code. A world key here is a TypeError before anything is sent.
|
|
2619
2652
|
*/
|
|
2620
2653
|
acceptJoin(code: string): Promise<OwJoinedMembership>;
|
|
2654
|
+
/**
|
|
2655
|
+
* POST /account/worlds/{worldId}/links -- a new invite link for a world this client's
|
|
2656
|
+
* `ow_a_` token owns (keel C1): `reader` is required (`person`, accepted with acceptJoin;
|
|
2657
|
+
* `agent`, redeemed at POST /join); `role` defaults to contributor, `days` (1, 7 or 30)
|
|
2658
|
+
* to 7; `withCharacter` (agent links only) to true. 201 with the code, shown in this
|
|
2659
|
+
* answer only. Owner only: anyone else, and a world that doesn't exist, gets 404
|
|
2660
|
+
* `not_found` (`err.isNotFound`). A world key is a TypeError before anything is sent.
|
|
2661
|
+
*/
|
|
2662
|
+
createWorldLink(worldId: string, opts: {
|
|
2663
|
+
reader: 'person' | 'agent';
|
|
2664
|
+
role?: OwMemberRole;
|
|
2665
|
+
days?: 1 | 7 | 30;
|
|
2666
|
+
inviterName?: string;
|
|
2667
|
+
withCharacter?: boolean;
|
|
2668
|
+
}): Promise<OwCreatedWorldLink>;
|
|
2669
|
+
/**
|
|
2670
|
+
* GET /account/worlds/{worldId}/links -- the world's invite links, without their codes:
|
|
2671
|
+
* each with its status (pending, used, revoked or expired) and uses. Owner only, as
|
|
2672
|
+
* createWorldLink. Needs the client's `ow_a_` token.
|
|
2673
|
+
*/
|
|
2674
|
+
listWorldLinks(worldId: string): Promise<OwWorldLink[]>;
|
|
2675
|
+
/**
|
|
2676
|
+
* DELETE /account/worlds/{worldId}/links/{linkId} -- revoke a link: its code no longer
|
|
2677
|
+
* works. A used, revoked or expired link answers the same and stays as it was; whoever
|
|
2678
|
+
* joined with it stays a member (remove them from the roster). Owner only, as
|
|
2679
|
+
* createWorldLink. Needs the client's `ow_a_` token.
|
|
2680
|
+
*/
|
|
2681
|
+
revokeWorldLink(worldId: string, linkId: string): Promise<void>;
|
|
2621
2682
|
/**
|
|
2622
2683
|
* POST /account/ask -- a question about a world the account owns or is in, answered by
|
|
2623
2684
|
* keel's AI proxy from `context` only (build it with buildAskContext from the elements
|
|
2624
2685
|
* the user sees). The answer is "The world doesn't say." when the context does not hold
|
|
2625
2686
|
* it. Needs the client's `ow_a_` token (a world key is a TypeError before sending).
|
|
2626
|
-
* Refusals: 429 `quota_exceeded` (`err.isQuotaExceeded`, the account's
|
|
2687
|
+
* Refusals: 429 `quota_exceeded` (`err.isQuotaExceeded`, the account's token rating used up for the day;
|
|
2627
2688
|
* Retry-After runs to midnight UTC), 503 `ask_unavailable` (`err.isAskUnavailable`:
|
|
2628
2689
|
* switched off, or paused for the day), 502 `ask_failed` (`err.isAskFailed`); none of
|
|
2629
2690
|
* them counts. 422 for a question over 500 characters or context past its limits.
|
|
@@ -2639,7 +2700,7 @@ declare class OwV2Client {
|
|
|
2639
2700
|
* lookupWorld's hits), sorted by the same proxy as ask into rows to review: `make`, `add_to`,
|
|
2640
2701
|
* `link`, `ask`. Nothing is written; the app applies what the user accepts. Every id in a
|
|
2641
2702
|
* row is from the slice; keel moves any other row to `not_proposed` with its reason.
|
|
2642
|
-
* The same account token,
|
|
2703
|
+
* The same account token, token rating (it spends the tokens it uses) and refusals as ask. 422
|
|
2643
2704
|
* names the param: notes 1 to 8, each up to 4,000 characters and 16,000 in all (text
|
|
2644
2705
|
* only), at most four pictures, each uploaded into this world; slice up to 100, names up
|
|
2645
2706
|
* to 200 characters, anchors up to 120.
|
|
@@ -2650,7 +2711,7 @@ declare class OwV2Client {
|
|
|
2650
2711
|
slice: OwSortRef[];
|
|
2651
2712
|
}): Promise<OwSortAnswer>;
|
|
2652
2713
|
/**
|
|
2653
|
-
* GET /account/allowance -- the account's
|
|
2714
|
+
* GET /account/allowance -- the account's token rating, the one daily meter ask, sort and
|
|
2654
2715
|
* the Council spend from (keel 872431f): the rating, what is used and left today, and
|
|
2655
2716
|
* when it resets (the next midnight UTC). Spends nothing. Needs the client's `ow_a_` token.
|
|
2656
2717
|
*/
|
|
@@ -3617,4 +3678,4 @@ declare class TokenResource {
|
|
|
3617
3678
|
getEncryptionInfo(): Promise<EncryptionInfo>;
|
|
3618
3679
|
}
|
|
3619
3680
|
|
|
3620
|
-
export { ASK_LIMITS, type AccessKeyResponse, CALENDAR_FIELD, CALENDAR_SUPERTYPE, type CalendarConfig, type CalendarEra, type CalendarIntercalary, type CalendarMonths, type CalendarWeek, ELEMENT_FAMILIES, ELEMENT_ICONS, ELEMENT_LABELS, ELEMENT_SECTIONS, ELEMENT_TYPES, type ElementFamily, type ElementType, type EncryptionInfo, type EraDomain, FAMILY_COLORS, FAMILY_ORDER, FIELD_SCHEMA, type FieldInfo, type FieldType, GameTier, type ListParams, ONLYWORLDS_VERSION, type OwAllowance, OwApiError, type OwAskAnswer, type OwAskContext, type OwAuthErrorCode, type OwBulkItem, type OwBulkItemResult, type OwBulkResponse, type OwCalendarElement, type OwChange, type OwChangesPage, type OwClientConfig, type OwElement, type OwElementBase, type OwErrorBody, type OwJoinPreview, type OwJoinedMembership, type OwKeyKind, type OwLinkEdit, type OwLookupElement, type OwLookupHit, type OwLookupLink, type OwLookupOptions, type OwLookupReason, type OwMe, type OwMediaTicket, type OwMember, type OwMemberRole, OwNetworkError, type OwPage, type OwPhotoOptions, type OwPhotoPlan, OwPreconditionFailedError, type OwPreparedPhoto, type OwReadWorldFile, type OwReadWorldFileOptions, type OwRemovalTicket, type OwRemovedImage, type OwRenderOptions, type OwSortAddToRow, type OwSortAnswer, type OwSortAskRow, type OwSortLinkRow, type OwSortMakeRow, type OwSortNote, type OwSortRef, type OwSortRow, type OwUploadedImage, OwV2Client, type OwWorldFileEntry, OwWorldFileError, type OwWorldFileReason, type OwWorldIndex, type OwWorldMeta, PHOTO_MAX_BYTES, PHOTO_TYPES, type ParseError, type ParseOptions, type ParseResult, type RevokeAllSessionsResponse, type RevokeSessionResponse, SPATIAL_TYPES, type SectionInfo, type StepBreakdown, type TokenConsumeParams, type TokenConsumeResponse, TokenResource, type TokenStatus, type TokenTransport, WORLD_FILE_MAX_BYTES, WORLD_FILE_MAX_ENTRIES, type WorldCalendar, absYearForEraYear, absoluteYear, approxYearLength, breakdownStep, buildAskContext, buildWorldIndex, detectKeyKind, displayYear, elementColor, eraForStep, errorFromResponse, familyOf, floorDiv, floorMod, formatDuration, formatMidLabel, formatStep, formatYearLabel, getElementIcon, getElementLabel, isDemoKey, isLeapYear, isParseError, kindCanWrite, lookupWorld, monthStartSteps, parseDate, parseErrorEnvelope, pinExpectation, planPhoto, preparePhoto, readCalendarConfig, readCalendarValue, readWorldFile, renderElement, resolveCalendarLens, resolveEraDomains, validateCalendarConfig, weekdayForStep, worldCalendars, writeWorldFile, yearLength, yearStartStep };
|
|
3681
|
+
export { ASK_LIMITS, type AccessKeyResponse, CALENDAR_FIELD, CALENDAR_SUPERTYPE, type CalendarConfig, type CalendarEra, type CalendarIntercalary, type CalendarMonths, type CalendarWeek, ELEMENT_FAMILIES, ELEMENT_ICONS, ELEMENT_LABELS, ELEMENT_SECTIONS, ELEMENT_TYPES, type ElementFamily, type ElementType, type EncryptionInfo, type EraDomain, FAMILY_COLORS, FAMILY_ORDER, FIELD_SCHEMA, type FieldInfo, type FieldType, GameTier, type ListParams, ONLYWORLDS_VERSION, type OwAllowance, OwApiError, type OwAskAnswer, type OwAskContext, type OwAuthErrorCode, type OwBulkItem, type OwBulkItemResult, type OwBulkResponse, type OwCalendarElement, type OwChange, type OwChangesPage, type OwClientConfig, type OwCreatedWorldLink, type OwElement, type OwElementBase, type OwErrorBody, type OwJoinPreview, type OwJoinedMembership, type OwKeyKind, type OwLinkEdit, type OwLookupElement, type OwLookupHit, type OwLookupLink, type OwLookupOptions, type OwLookupReason, type OwMe, type OwMediaTicket, type OwMember, type OwMemberRole, OwNetworkError, type OwPage, type OwPhotoOptions, type OwPhotoPlan, OwPreconditionFailedError, type OwPreparedPhoto, type OwReadWorldFile, type OwReadWorldFileOptions, type OwRemovalTicket, type OwRemovedImage, type OwRenderOptions, type OwSortAddToRow, type OwSortAnswer, type OwSortAskRow, type OwSortLinkRow, type OwSortMakeRow, type OwSortNote, type OwSortRef, type OwSortRow, type OwUploadedImage, OwV2Client, type OwWorldFileEntry, OwWorldFileError, type OwWorldFileReason, type OwWorldIndex, type OwWorldLink, type OwWorldMeta, PHOTO_MAX_BYTES, PHOTO_TYPES, type ParseError, type ParseOptions, type ParseResult, type RevokeAllSessionsResponse, type RevokeSessionResponse, SPATIAL_TYPES, type SectionInfo, type StepBreakdown, type TokenConsumeParams, type TokenConsumeResponse, TokenResource, type TokenStatus, type TokenTransport, WORLD_FILE_MAX_BYTES, WORLD_FILE_MAX_ENTRIES, type WorldCalendar, absYearForEraYear, absoluteYear, approxYearLength, breakdownStep, buildAskContext, buildWorldIndex, detectKeyKind, displayYear, elementColor, eraForStep, errorFromResponse, familyOf, floorDiv, floorMod, formatDuration, formatMidLabel, formatStep, formatYearLabel, getElementIcon, getElementLabel, isDemoKey, isLeapYear, isParseError, kindCanWrite, lookupWorld, monthStartSteps, parseDate, parseErrorEnvelope, pinExpectation, planPhoto, preparePhoto, readCalendarConfig, readCalendarValue, readWorldFile, renderElement, resolveCalendarLens, resolveEraDomains, validateCalendarConfig, weekdayForStep, worldCalendars, writeWorldFile, yearLength, yearStartStep };
|
package/dist/index.js
CHANGED
|
@@ -489,10 +489,10 @@ var OwV2Client = class {
|
|
|
489
489
|
/**
|
|
490
490
|
* POST /account/join -- accept an invite link's code as the account this client's
|
|
491
491
|
* `ow_a_` token belongs to: 201 with the new membership. Refusals: 404 `not_found`
|
|
492
|
-
* (every bad code, and a code made for an AI agent)
|
|
493
|
-
* (`err.isAlreadyMember`)
|
|
494
|
-
*
|
|
495
|
-
* before anything is sent.
|
|
492
|
+
* (every bad code, and a code made for an AI agent) and 409 `already_member`
|
|
493
|
+
* (`err.isAlreadyMember`). Accepting needs no account PIN, for any role (keel #297,
|
|
494
|
+
* ed73c90); a write key for the membership waits for one (`pin_required`). A refusal
|
|
495
|
+
* never spends the code. A world key here is a TypeError before anything is sent.
|
|
496
496
|
*/
|
|
497
497
|
async acceptJoin(code) {
|
|
498
498
|
if (this.keyKind !== "account") {
|
|
@@ -500,13 +500,56 @@ var OwV2Client = class {
|
|
|
500
500
|
}
|
|
501
501
|
return this.request("POST", "/account/join", { body: { code } });
|
|
502
502
|
}
|
|
503
|
+
/**
|
|
504
|
+
* POST /account/worlds/{worldId}/links -- a new invite link for a world this client's
|
|
505
|
+
* `ow_a_` token owns (keel C1): `reader` is required (`person`, accepted with acceptJoin;
|
|
506
|
+
* `agent`, redeemed at POST /join); `role` defaults to contributor, `days` (1, 7 or 30)
|
|
507
|
+
* to 7; `withCharacter` (agent links only) to true. 201 with the code, shown in this
|
|
508
|
+
* answer only. Owner only: anyone else, and a world that doesn't exist, gets 404
|
|
509
|
+
* `not_found` (`err.isNotFound`). A world key is a TypeError before anything is sent.
|
|
510
|
+
*/
|
|
511
|
+
async createWorldLink(worldId, opts) {
|
|
512
|
+
if (this.keyKind !== "account") {
|
|
513
|
+
throw new TypeError("createWorldLink needs an account token (ow_a_): only the world's owner makes links");
|
|
514
|
+
}
|
|
515
|
+
const body = { reader: opts.reader };
|
|
516
|
+
if (opts.role !== void 0) body.role = opts.role;
|
|
517
|
+
if (opts.days !== void 0) body.days = opts.days;
|
|
518
|
+
if (opts.inviterName !== void 0) body.inviter_name = opts.inviterName;
|
|
519
|
+
if (opts.withCharacter !== void 0) body.with_character = opts.withCharacter;
|
|
520
|
+
return this.request("POST", `/account/worlds/${encodeURIComponent(worldId)}/links`, { body });
|
|
521
|
+
}
|
|
522
|
+
/**
|
|
523
|
+
* GET /account/worlds/{worldId}/links -- the world's invite links, without their codes:
|
|
524
|
+
* each with its status (pending, used, revoked or expired) and uses. Owner only, as
|
|
525
|
+
* createWorldLink. Needs the client's `ow_a_` token.
|
|
526
|
+
*/
|
|
527
|
+
async listWorldLinks(worldId) {
|
|
528
|
+
if (this.keyKind !== "account") {
|
|
529
|
+
throw new TypeError("listWorldLinks needs an account token (ow_a_): only the world's owner sees its links");
|
|
530
|
+
}
|
|
531
|
+
const page = await this.request("GET", `/account/worlds/${encodeURIComponent(worldId)}/links`);
|
|
532
|
+
return page.data;
|
|
533
|
+
}
|
|
534
|
+
/**
|
|
535
|
+
* DELETE /account/worlds/{worldId}/links/{linkId} -- revoke a link: its code no longer
|
|
536
|
+
* works. A used, revoked or expired link answers the same and stays as it was; whoever
|
|
537
|
+
* joined with it stays a member (remove them from the roster). Owner only, as
|
|
538
|
+
* createWorldLink. Needs the client's `ow_a_` token.
|
|
539
|
+
*/
|
|
540
|
+
async revokeWorldLink(worldId, linkId) {
|
|
541
|
+
if (this.keyKind !== "account") {
|
|
542
|
+
throw new TypeError("revokeWorldLink needs an account token (ow_a_): only the world's owner revokes links");
|
|
543
|
+
}
|
|
544
|
+
await this.request("DELETE", `/account/worlds/${encodeURIComponent(worldId)}/links/${encodeURIComponent(linkId)}`);
|
|
545
|
+
}
|
|
503
546
|
// -- Ask your world (keel #159) -------------------------------------------
|
|
504
547
|
/**
|
|
505
548
|
* POST /account/ask -- a question about a world the account owns or is in, answered by
|
|
506
549
|
* keel's AI proxy from `context` only (build it with buildAskContext from the elements
|
|
507
550
|
* the user sees). The answer is "The world doesn't say." when the context does not hold
|
|
508
551
|
* it. Needs the client's `ow_a_` token (a world key is a TypeError before sending).
|
|
509
|
-
* Refusals: 429 `quota_exceeded` (`err.isQuotaExceeded`, the account's
|
|
552
|
+
* Refusals: 429 `quota_exceeded` (`err.isQuotaExceeded`, the account's token rating used up for the day;
|
|
510
553
|
* Retry-After runs to midnight UTC), 503 `ask_unavailable` (`err.isAskUnavailable`:
|
|
511
554
|
* switched off, or paused for the day), 502 `ask_failed` (`err.isAskFailed`); none of
|
|
512
555
|
* them counts. 422 for a question over 500 characters or context past its limits.
|
|
@@ -525,7 +568,7 @@ var OwV2Client = class {
|
|
|
525
568
|
* lookupWorld's hits), sorted by the same proxy as ask into rows to review: `make`, `add_to`,
|
|
526
569
|
* `link`, `ask`. Nothing is written; the app applies what the user accepts. Every id in a
|
|
527
570
|
* row is from the slice; keel moves any other row to `not_proposed` with its reason.
|
|
528
|
-
* The same account token,
|
|
571
|
+
* The same account token, token rating (it spends the tokens it uses) and refusals as ask. 422
|
|
529
572
|
* names the param: notes 1 to 8, each up to 4,000 characters and 16,000 in all (text
|
|
530
573
|
* only), at most four pictures, each uploaded into this world; slice up to 100, names up
|
|
531
574
|
* to 200 characters, anchors up to 120.
|
|
@@ -539,7 +582,7 @@ var OwV2Client = class {
|
|
|
539
582
|
});
|
|
540
583
|
}
|
|
541
584
|
/**
|
|
542
|
-
* GET /account/allowance -- the account's
|
|
585
|
+
* GET /account/allowance -- the account's token rating, the one daily meter ask, sort and
|
|
543
586
|
* the Council spend from (keel 872431f): the rating, what is used and left today, and
|
|
544
587
|
* when it resets (the next midnight UTC). Spends nothing. Needs the client's `ow_a_` token.
|
|
545
588
|
*/
|