Skip to content

Thing methods: restore, share, unrelate

The Thing Verbs restore, share, unrelate as typed SDK methods, with inputs, result, refusals and an example.

Thing.shareMode do
curl -X POST https://api.sb/leaseline.app/things/thing_8ds0r9vvRl/share \
  -H "Authorization: Bearer $SB_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"to":"party_hmQWaPrAyZ","verbs":["Example verbs"]}'
API referenceThing.share
npx startup-builder do Thing.share --data '{"thing":"thing_8ds0r9vvRl","to":"party_hmQWaPrAyZ","verbs":["Example verbs"]}'
CLI referenceThing.share
{
  "name": "do",
  "arguments": {
    "code": "return await $.Thing.share({ thing: 'thing_8ds0r9vvRl', to: 'party_hmQWaPrAyZ', verbs: ['Example verbs'] })"
  }
}
MCP referenceThing.share
import { $ } from 'startup-builder'

const { permission, thing } = await $.Thing.share({ thing: 'thing_8ds0r9vvRl', to: 'party_hmQWaPrAyZ', verbs: ['Example verbs'] })
SDK referenceThing.share

Reference for Thing, one group of Thing methods.

Thing.restore

Restore brings back a deleted Thing, or one an undone Action removed, with its history and Relationships intact. Verb page.

TypeScript
interface ThingVerbs {
  restore(input: ThingRestoreInput, options?: SB.CallOptions): SB.Call<Thing>
}

Emits Thing.restored.

Inputs

InputTypeRequiredDescription
thingThingrequiredThe deleted Thing.

Returns

OutputTypeRequiredDescription
thingThingrequiredThe Thing, back in every list and query it left.

Refuses when

CheckErrorFixThen call
The key is valid, but its scopes do not allow this operationforbiddenUse a key whose scopes cover the operation, or ask an owner of the namespace to grant them.None.
The Thing is not deletedrefusedClear what the check names, then call it again.None.
thing is missing, or is not a thinginvalid-inputSend thing as a thing, then call it again.None.
The Idempotency-Key was sent before with another operation or other inputidempotency-mismatchSend a new key for new input; reuse a key only to retry the same request.None.

Example

TypeScript
import { $ } from 'startup-builder'

const thing = await $.Thing.restore({ thing: 'thing_8ds0r9vvRl' }, { idempotencyKey: 'leaseline-thing-restore-1' })

Thing.share

Share grants a person, a Role or a guest Verbs on one record and everything it contains. Verb page.

TypeScript
interface ThingVerbs {
  share(input: ThingShareInput, options?: SB.CallOptions): SB.Call<ThingShareOutput>
}

Emits Thing.shared.

Inputs

InputTypeRequiredDescription
thingThingrequiredThe record to share.
toPartyrequiredWho receives the grant: a person, or a guest who fills only the guest Role.
verbsstring[]requiredThe Verbs granted, such as get and comment.

Returns

OutputTypeRequiredDescription
permissionPermissionrequiredThe grant, scoped to the record and its contents.
thingThingrequiredThe Thing shared.

Refuses when

CheckErrorFixThen call
The key is valid, but its scopes do not allow this operationforbiddenUse a key whose scopes cover the operation, or ask an owner of the namespace to grant them.None.
thing is missing, or is not a thinginvalid-inputSend thing as a thing, then call it again.None.
to is missing, or is not a partyinvalid-inputSend to as a party, then call it again.None.
verbs is missing, or is not a string listinvalid-inputSend verbs as a string list, then call it again.None.
The Idempotency-Key was sent before with another operation or other inputidempotency-mismatchSend a new key for new input; reuse a key only to retry the same request.None.

Example

TypeScript
import { $ } from 'startup-builder'

const { permission, thing } = await $.Thing.share({ thing: 'thing_8ds0r9vvRl', to: 'party_hmQWaPrAyZ', verbs: ['Example verbs'] }, { idempotencyKey: 'leaseline-thing-share-1' })

Thing.unrelate

Unrelate ends a Relationship between two Things; the link stays in history and reads back at any earlier moment. Verb page.

TypeScript
interface ThingVerbs {
  unrelate(input: ThingUnrelateInput, options?: SB.CallOptions): SB.Call<ThingUnrelateOutput>
}

Emits Thing.unrelated.

Inputs

InputTypeRequiredDescription
thingThingrequiredThe source Thing.
predicatestringrequiredThe Relationship as read from the source.
toThingrequiredThe target Thing.

Returns

OutputTypeRequiredDescription
relationshipRelationshiprequiredThe ended Relationship.
thingThingrequiredThe Thing the Relationship started from.

Refuses when

CheckErrorFixThen call
The key is valid, but its scopes do not allow this operationforbiddenUse a key whose scopes cover the operation, or ask an owner of the namespace to grant them.None.
thing is missing, or is not a thinginvalid-inputSend thing as a thing, then call it again.None.
predicate is missing, or is not a stringinvalid-inputSend predicate as a string, then call it again.None.
to is missing, or is not a thinginvalid-inputSend to as a thing, then call it again.None.
The Idempotency-Key was sent before with another operation or other inputidempotency-mismatchSend a new key for new input; reuse a key only to retry the same request.None.

Example

TypeScript
import { $ } from 'startup-builder'

const { relationship, thing } = await $.Thing.unrelate({ thing: 'thing_8ds0r9vvRl', predicate: 'Example predicate', to: 'thing_8ds0r9vvRl' }, { idempotencyKey: 'leaseline-thing-unrelate-1' })