UNPKG

@xmtp/proto

Version:

Protobuf client and generated classes for GRPC API

188 lines (187 loc) 6.61 kB
// 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/contact.proto /* eslint-disable */ import Long from "long"; import _m0 from "protobufjs/minimal"; import { PublicKeyBundle, SignedPublicKeyBundle } from "./public_key.pb"; export const protobufPackage = "xmtp.message_contents"; function createBaseContactBundleV1() { return { keyBundle: undefined }; } export const ContactBundleV1 = { encode(message, writer = _m0.Writer.create()) { if (message.keyBundle !== undefined) { PublicKeyBundle.encode(message.keyBundle, writer.uint32(10).fork()).ldelim(); } return writer; }, decode(input, length) { const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseContactBundleV1(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: if (tag !== 10) { break; } message.keyBundle = PublicKeyBundle.decode(reader, reader.uint32()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } reader.skipType(tag & 7); } return message; }, fromJSON(object) { return { keyBundle: isSet(object.keyBundle) ? PublicKeyBundle.fromJSON(object.keyBundle) : undefined }; }, toJSON(message) { const obj = {}; if (message.keyBundle !== undefined) { obj.keyBundle = PublicKeyBundle.toJSON(message.keyBundle); } return obj; }, create(base) { return ContactBundleV1.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseContactBundleV1(); message.keyBundle = (object.keyBundle !== undefined && object.keyBundle !== null) ? PublicKeyBundle.fromPartial(object.keyBundle) : undefined; return message; }, }; function createBaseContactBundleV2() { return { keyBundle: undefined }; } export const ContactBundleV2 = { encode(message, writer = _m0.Writer.create()) { if (message.keyBundle !== undefined) { SignedPublicKeyBundle.encode(message.keyBundle, writer.uint32(10).fork()).ldelim(); } return writer; }, decode(input, length) { const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseContactBundleV2(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: if (tag !== 10) { break; } message.keyBundle = SignedPublicKeyBundle.decode(reader, reader.uint32()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } reader.skipType(tag & 7); } return message; }, fromJSON(object) { return { keyBundle: isSet(object.keyBundle) ? SignedPublicKeyBundle.fromJSON(object.keyBundle) : undefined }; }, toJSON(message) { const obj = {}; if (message.keyBundle !== undefined) { obj.keyBundle = SignedPublicKeyBundle.toJSON(message.keyBundle); } return obj; }, create(base) { return ContactBundleV2.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseContactBundleV2(); message.keyBundle = (object.keyBundle !== undefined && object.keyBundle !== null) ? SignedPublicKeyBundle.fromPartial(object.keyBundle) : undefined; return message; }, }; function createBaseContactBundle() { return { v1: undefined, v2: undefined }; } export const ContactBundle = { encode(message, writer = _m0.Writer.create()) { if (message.v1 !== undefined) { ContactBundleV1.encode(message.v1, writer.uint32(10).fork()).ldelim(); } if (message.v2 !== undefined) { ContactBundleV2.encode(message.v2, writer.uint32(18).fork()).ldelim(); } return writer; }, decode(input, length) { const reader = input instanceof _m0.Reader ? input : _m0.Reader.create(input); let end = length === undefined ? reader.len : reader.pos + length; const message = createBaseContactBundle(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: if (tag !== 10) { break; } message.v1 = ContactBundleV1.decode(reader, reader.uint32()); continue; case 2: if (tag !== 18) { break; } message.v2 = ContactBundleV2.decode(reader, reader.uint32()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } reader.skipType(tag & 7); } return message; }, fromJSON(object) { return { v1: isSet(object.v1) ? ContactBundleV1.fromJSON(object.v1) : undefined, v2: isSet(object.v2) ? ContactBundleV2.fromJSON(object.v2) : undefined, }; }, toJSON(message) { const obj = {}; if (message.v1 !== undefined) { obj.v1 = ContactBundleV1.toJSON(message.v1); } if (message.v2 !== undefined) { obj.v2 = ContactBundleV2.toJSON(message.v2); } return obj; }, create(base) { return ContactBundle.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseContactBundle(); message.v1 = (object.v1 !== undefined && object.v1 !== null) ? ContactBundleV1.fromPartial(object.v1) : undefined; message.v2 = (object.v2 !== undefined && object.v2 !== null) ? ContactBundleV2.fromPartial(object.v2) : undefined; return message; }, }; if (_m0.util.Long !== Long) { _m0.util.Long = Long; _m0.configure(); } function isSet(value) { return value !== null && value !== undefined; }