Skip to main content

Class: Duration

google.protobuf.Duration

Represents a Duration.

Implements#

Constructors#

constructor#

new Duration(properties?)

Constructs a new Duration.

Parameters#

NameType
properties?IDuration

Properties#

nanos#

nanos: number

Duration nanos.

Implementation of#

IDuration.nanos


seconds#

seconds: Long

Duration seconds.

Implementation of#

IDuration.seconds

Methods#

toJSON#

toJSON(): Object

Converts this Duration to JSON.

Returns#

Object

JSON object


decode#

Static decode(reader, length?): Duration

Decodes a Duration 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#

Duration

Duration


decodeDelimited#

Static decodeDelimited(reader): Duration

Decodes a Duration 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#

Duration

Duration


encode#

Static encode(message, writer?): Writer

Encodes the specified Duration message. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages.

Parameters#

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

Returns#

Writer

Writer


encodeDelimited#

Static encodeDelimited(message, writer?): Writer

Encodes the specified Duration message, length delimited. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages.

Parameters#

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

Returns#

Writer

Writer


fromObject#

Static fromObject(object): Duration

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

Parameters#

NameTypeDescription
objectObjectPlain object

Returns#

Duration

Duration


toObject#

Static toObject(message, options?): Object

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

Parameters#

NameTypeDescription
messageDurationDuration
options?IConversionOptions-

Returns#

Object

Plain object