Event
This class defines an Event from a [[Book]].
An event is an object that represents an action (such as posting or deleting a [[Transaction]]) made by an actor (such as a user or a Bot acting on behalf of a user).
Constructors
Constructor
new Event(book, payload?): Event;Parameters
| Parameter | Type |
|---|---|
book | Book |
payload? | Event |
Returns
Event
Properties
payload
payload: Event;Methods
getAgent()
getAgent(): Agent | undefined;Gets the Agent who performed the Event.
Returns
Agent | undefined
The Agent who performed the Event
getBook()
getBook(): Book;Gets the book in which the Event was created.
Returns
The book in which the Event was created
getBotResponses()
getBotResponses(): BotResponse[];Gets the Bot Responses associated to this Event.
Returns
The Bot Responses associated to this Event
getCreatedAt()
getCreatedAt(): Date | undefined;Gets the date the Event was created.
Returns
Date | undefined
The date the Event was created
getId()
getId(): string | undefined;Gets the id of the Event.
Returns
string | undefined
The id of the Event
getType()
getType(): EventType | undefined;Gets the type of the Event.
Returns
EventType | undefined
The type of the Event
getUser()
getUser(): User | undefined;Gets the user who performed the Event.
Returns
User | undefined
The user who performed the Event
hasErrorResponse()
hasErrorResponse(): boolean;Checks if this Event has at least one Bot Response of type ERROR.
Returns
boolean
True if this Event has at least one Bot Response of type ERROR
json()
json(): Event;Gets an immutable copy of the JSON payload for this Event.
Returns
Event
The wrapped plain json object