UmweltDocs
Reference/Commands/entityType.create
entityType.createcommandsince 0.1

Declares a kind of entity, its fields, and whether its entities can hold knowledge.

Request
umwelt call story.umw entityType.create '{
  "projectId": "ball",
  "id": "person",
  "name": "Person",
  "kind": "agent"
}'
Request
const result = await client.entityTypeCreate({ projectId: 'ball', id: 'person', name: 'Person', kind: 'agent' });
Request
var result = engine.EntityTypeCreate(new CreateEntityTypeInput
{
    ProjectId = "ball",
    Id = "person",
    Name = "Person",
    Kind = EntityKind.Agent,
});
Response
{
  "kind": "agent",
  "id": "person",
  "projectId": "ball",
  "name": "Person",
  "fields": []
}

Payload

FieldTypeDescription
projectIdrequiredstringThe project to write to.
idstringIts id. Generated when absent.
namerequiredstringIts name.
kindrequired"agent" | "group" | "other"agent (a person, an NPC, a reader) and group (a guild, a council) can hold knowledge. other (a place, an object) can only be talked about.
fieldsFieldDef[]default []The fields its entities carry: id, key, label, type and constraints.

Result

FieldTypeDescription
idalwaysstringThe type’s id.
projectIdalwaysstringThe project it belongs to.
namealwaysstringIts name.
kindalways"agent" | "group" | "other"agent and group can hold knowledge; other can only be talked about.
fieldsFieldDef[]The fields its entities carry.

Rules

Only agents and groups hold. A Holding, Awareness or Disposition whose holder is of kind other is refused.

Errors

VALIDATION_FAILEDThe payload is malformed.
CONFLICTAn entity type with that id exists.
NOT_FOUNDThe project does not exist.
HANDSHAKE_REQUIREDOver the protocol, hello was not sent first.

Every code is listed in Errors.

See also

Was this page helpful?