Skip to main content

Class: Payload

coresdk.common.Payload

Represents a Payload.

Implements#

Constructors#

constructor#

new Payload(properties?)

Constructs a new Payload.

Parameters#

NameType
properties?IPayload

Properties#

data#

data: Uint8Array

Payload data.

Implementation of#

IPayload.data


metadata#

metadata: Object

Payload metadata.

Index signature#

▪ [k: string]: Uint8Array

Implementation of#

IPayload.metadata

Methods#

toJSON#

toJSON(): Object

Converts this Payload to JSON.

Returns#

Object

JSON object


decode#

Static decode(reader, length?): Payload

Decodes a Payload message from the specified reader or buffer.

throws {Error} If the payload is not a reader or valid buffer

throws {$protobuf.util.ProtocolError} If required fields are missing

Parameters#

NameTypeDescription
readerUint8Array | ReaderReader or buffer to decode from
length?number-

Returns#

Payload

Payload


decodeDelimited#

Static decodeDelimited(reader): Payload

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

throws {Error} If the payload is not a reader or valid buffer

throws {$protobuf.util.ProtocolError} If required fields are missing

Parameters#

NameTypeDescription
readerUint8Array | ReaderReader or buffer to decode from

Returns#

Payload

Payload


encode#

Static encode(message, writer?): Writer

Encodes the specified Payload message. Does not implicitly {@link coresdk.common.Payload.verify|verify} messages.

Parameters#

NameTypeDescription
messageIPayloadPayload message or plain object to encode
writer?Writer-

Returns#

Writer

Writer


encodeDelimited#

Static encodeDelimited(message, writer?): Writer

Encodes the specified Payload message, length delimited. Does not implicitly {@link coresdk.common.Payload.verify|verify} messages.

Parameters#

NameTypeDescription
messageIPayloadPayload message or plain object to encode
writer?Writer-

Returns#

Writer

Writer


fromObject#

Static fromObject(object): Payload

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

Parameters#

NameTypeDescription
objectObjectPlain object

Returns#

Payload

Payload


toObject#

Static toObject(message, options?): Object

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

Parameters#

NameTypeDescription
messagePayloadPayload
options?IConversionOptions-

Returns#

Object

Plain object