Skip to main content

Class: Struct

google.protobuf.Struct

Represents a Struct.

Implements

Constructors

constructor

new Struct(properties?): Struct

Constructs a new Struct.

Parameters

NameTypeDescription
properties?IStructProperties to set

Returns

Struct

Properties

fields

fields: Object

Struct fields.

Index signature

▪ [k: string]: IValue

Implementation of

IStruct.fields

Methods

create

create(properties?): Struct

Creates a new Struct instance using the specified properties.

Parameters

NameTypeDescription
properties?IStructProperties to set

Returns

Struct

Struct instance


decode

decode(reader, length?): Struct

Decodes a Struct message from the specified reader or buffer.

Parameters

NameTypeDescription
readerUint8Array | ReaderReader or buffer to decode from
length?numberMessage length if known beforehand

Returns

Struct

Struct

Throws

If the payload is not a reader or valid buffer

Throws

If required fields are missing


decodeDelimited

decodeDelimited(reader): Struct

Decodes a Struct message from the specified reader or buffer, length delimited.

Parameters

NameTypeDescription
readerUint8Array | ReaderReader or buffer to decode from

Returns

Struct

Struct

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 Struct message. Does not implicitly verify messages.

Parameters

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

Returns

Writer

Writer


encodeDelimited

encodeDelimited(message, writer?): Writer

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

Parameters

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

Returns

Writer

Writer


fromObject

fromObject(object): Struct

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

Parameters

NameTypeDescription
objectObjectPlain object

Returns

Struct

Struct


getTypeUrl

getTypeUrl(typeUrlPrefix?): string

Gets the default type url for Struct

Parameters

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

Returns

string

The default type url


toJSON

toJSON(): Object

Converts this Struct to JSON.

Returns

Object

JSON object


toObject

toObject(message, options?): Object

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

Parameters

NameTypeDescription
messageStructStruct
options?IConversionOptionsConversion options

Returns

Object

Plain object


verify

verify(message): string

Verifies a Struct message.

Parameters

NameTypeDescription
messageObjectPlain object to verify

Returns

string

null if valid, otherwise the reason why it is not