Skip to main content

Class: Entity

protocol.Entity

Represents an Entity.

Implements

Constructors

constructor

new Entity(properties?): Entity

Constructs a new Entity.

Parameters

NameTypeDescription
properties?IEntityProperties to set

Returns

Entity

Properties

id

id: string

Entity id.

Implementation of

IEntity.id


metadata

metadata: string

Entity metadata.

Implementation of

IEntity.metadata


operation

operation: Operation

Entity operation.

Implementation of

IEntity.operation


type

type: string

Entity type.

Implementation of

IEntity.type

Methods

create

create(properties?): Entity

Creates a new Entity instance using the specified properties.

Parameters

NameTypeDescription
properties?IEntityProperties to set

Returns

Entity

Entity instance


decode

decode(reader, length?): Entity

Decodes an Entity message from the specified reader or buffer.

Parameters

NameTypeDescription
readerReader | Uint8ArrayReader or buffer to decode from
length?numberMessage length if known beforehand

Returns

Entity

Entity

Throws

If the payload is not a reader or valid buffer

Throws

If required fields are missing


decodeDelimited

decodeDelimited(reader): Entity

Decodes an Entity message from the specified reader or buffer, length delimited.

Parameters

NameTypeDescription
readerReader | Uint8ArrayReader or buffer to decode from

Returns

Entity

Entity

Throws

If the payload is not a reader or valid buffer

Throws

If required fields are missing


encode

encode(message, writer?): Writer

Encodes the specified Entity message. Does not implicitly verify messages.

Parameters

NameTypeDescription
messageIEntityEntity message or plain object to encode
writer?WriterWriter to encode to

Returns

Writer

Writer


encodeDelimited

encodeDelimited(message, writer?): Writer

Encodes the specified Entity message, length delimited. Does not implicitly verify messages.

Parameters

NameTypeDescription
messageIEntityEntity message or plain object to encode
writer?WriterWriter to encode to

Returns

Writer

Writer


fromObject

fromObject(object): Entity

Creates an Entity message from a plain object. Also converts values to their respective internal types.

Parameters

NameTypeDescription
objectObjectPlain object

Returns

Entity

Entity


getTypeUrl

getTypeUrl(typeUrlPrefix?): string

Gets the default type url for Entity

Parameters

NameTypeDescription
typeUrlPrefix?stringyour custom typeUrlPrefix(default "type.googleapis.com")

Returns

string

The default type url


toJSON

toJSON(): Object

Converts this Entity to JSON.

Returns

Object

JSON object


toObject

toObject(message, options?): Object

Creates a plain object from an Entity message. Also converts values to other types if specified.

Parameters

NameTypeDescription
messageEntityEntity
options?IConversionOptionsConversion options

Returns

Object

Plain object


verify

verify(message): string

Verifies an Entity message.

Parameters

NameTypeDescription
messageObjectPlain object to verify

Returns

string

null if valid, otherwise the reason why it is not