UNPKG

@xmtp/proto

Version:

Protobuf client and generated classes for GRPC API

140 lines (139 loc) 5.93 kB
"use strict"; // Code generated by protoc-gen-ts_proto. DO NOT EDIT. // versions: // protoc-gen-ts_proto v1.181.2 // protoc v3.21.12 // source: message_contents/conversation_reference.proto var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.ConversationReference = exports.protobufPackage = void 0; /* eslint-disable */ const long_1 = __importDefault(require("long")); const minimal_1 = __importDefault(require("protobufjs/minimal")); const invitation_pb_1 = require("./invitation.pb"); exports.protobufPackage = "xmtp.message_contents"; function createBaseConversationReference() { return { topic: "", peerAddress: "", createdNs: long_1.default.UZERO, context: undefined, consentProofPayload: undefined }; } exports.ConversationReference = { encode(message, writer = minimal_1.default.Writer.create()) { if (message.topic !== "") { writer.uint32(10).string(message.topic); } if (message.peerAddress !== "") { writer.uint32(18).string(message.peerAddress); } if (!message.createdNs.equals(long_1.default.UZERO)) { writer.uint32(24).uint64(message.createdNs); } if (message.context !== undefined) { invitation_pb_1.InvitationV1_Context.encode(message.context, writer.uint32(34).fork()).ldelim(); } if (message.consentProofPayload !== undefined) { invitation_pb_1.ConsentProofPayload.encode(message.consentProofPayload, writer.uint32(42).fork()).ldelim(); } return writer; }, decode(input, length) { const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseConversationReference(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: if (tag !== 10) { break; } message.topic = reader.string(); continue; case 2: if (tag !== 18) { break; } message.peerAddress = reader.string(); continue; case 3: if (tag !== 24) { break; } message.createdNs = reader.uint64(); continue; case 4: if (tag !== 34) { break; } message.context = invitation_pb_1.InvitationV1_Context.decode(reader, reader.uint32()); continue; case 5: if (tag !== 42) { break; } message.consentProofPayload = invitation_pb_1.ConsentProofPayload.decode(reader, reader.uint32()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } reader.skipType(tag & 7); } return message; }, fromJSON(object) { return { topic: isSet(object.topic) ? globalThis.String(object.topic) : "", peerAddress: isSet(object.peerAddress) ? globalThis.String(object.peerAddress) : "", createdNs: isSet(object.createdNs) ? long_1.default.fromValue(object.createdNs) : long_1.default.UZERO, context: isSet(object.context) ? invitation_pb_1.InvitationV1_Context.fromJSON(object.context) : undefined, consentProofPayload: isSet(object.consentProofPayload) ? invitation_pb_1.ConsentProofPayload.fromJSON(object.consentProofPayload) : undefined, }; }, toJSON(message) { const obj = {}; if (message.topic !== "") { obj.topic = message.topic; } if (message.peerAddress !== "") { obj.peerAddress = message.peerAddress; } if (!message.createdNs.equals(long_1.default.UZERO)) { obj.createdNs = (message.createdNs || long_1.default.UZERO).toString(); } if (message.context !== undefined) { obj.context = invitation_pb_1.InvitationV1_Context.toJSON(message.context); } if (message.consentProofPayload !== undefined) { obj.consentProofPayload = invitation_pb_1.ConsentProofPayload.toJSON(message.consentProofPayload); } return obj; }, create(base) { return exports.ConversationReference.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseConversationReference(); message.topic = object.topic ?? ""; message.peerAddress = object.peerAddress ?? ""; message.createdNs = (object.createdNs !== undefined && object.createdNs !== null) ? long_1.default.fromValue(object.createdNs) : long_1.default.UZERO; message.context = (object.context !== undefined && object.context !== null) ? invitation_pb_1.InvitationV1_Context.fromPartial(object.context) : undefined; message.consentProofPayload = (object.consentProofPayload !== undefined && object.consentProofPayload !== null) ? invitation_pb_1.ConsentProofPayload.fromPartial(object.consentProofPayload) : undefined; return message; }, }; if (minimal_1.default.util.Long !== long_1.default) { minimal_1.default.util.Long = long_1.default; minimal_1.default.configure(); } function isSet(value) { return value !== null && value !== undefined; }