UNPKG

@zitadel/node

Version:

Library for API access to ZITADEL. Provides compiled gRPC service clients and helpers for applications and service accounts.

83 lines (82 loc) 2.71 kB
// Code generated by protoc-gen-ts_proto. DO NOT EDIT. // versions: // protoc-gen-ts_proto v2.7.7 // protoc unknown // source: google/protobuf/duration.proto /* eslint-disable */ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; import Long from "long"; export const protobufPackage = "google.protobuf"; function createBaseDuration() { return { seconds: Long.ZERO, nanos: 0 }; } export const Duration = { encode(message, writer = new BinaryWriter()) { if (!message.seconds.equals(Long.ZERO)) { writer.uint32(8).int64(message.seconds.toString()); } if (message.nanos !== 0) { writer.uint32(16).int32(message.nanos); } return writer; }, decode(input, length) { const reader = input instanceof BinaryReader ? input : new BinaryReader(input); const end = length === undefined ? reader.len : reader.pos + length; const message = createBaseDuration(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: { if (tag !== 8) { break; } message.seconds = Long.fromString(reader.int64().toString()); continue; } case 2: { if (tag !== 16) { break; } message.nanos = reader.int32(); continue; } } if ((tag & 7) === 4 || tag === 0) { break; } reader.skip(tag & 7); } return message; }, fromJSON(object) { return { seconds: isSet(object.seconds) ? Long.fromValue(object.seconds) : Long.ZERO, nanos: isSet(object.nanos) ? globalThis.Number(object.nanos) : 0, }; }, toJSON(message) { const obj = {}; if (!message.seconds.equals(Long.ZERO)) { obj.seconds = (message.seconds || Long.ZERO).toString(); } if (message.nanos !== 0) { obj.nanos = Math.round(message.nanos); } return obj; }, create(base) { return Duration.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseDuration(); message.seconds = (object.seconds !== undefined && object.seconds !== null) ? Long.fromValue(object.seconds) : Long.ZERO; message.nanos = object.nanos ?? 0; return message; }, }; function isSet(value) { return value !== null && value !== undefined; }