UNPKG

@xmtp/proto

Version:

Protobuf client and generated classes for GRPC API

241 lines (240 loc) 8.41 kB
// Code generated by protoc-gen-ts_proto. DO NOT EDIT. // versions: // protoc-gen-ts_proto v1.181.2 // protoc v3.21.12 // source: mls/message_contents/group_mutable_metadata.proto /* eslint-disable */ import Long from "long"; import _m0 from "protobufjs/minimal"; export const protobufPackage = "xmtp.mls.message_contents"; function createBaseGroupMutableMetadataV1() { return { attributes: {}, adminList: undefined, superAdminList: undefined }; } export const GroupMutableMetadataV1 = { encode(message, writer = _m0.Writer.create()) { Object.entries(message.attributes).forEach(([key, value]) => { GroupMutableMetadataV1_AttributesEntry.encode({ key: key, value }, writer.uint32(10).fork()).ldelim(); }); if (message.adminList !== undefined) { Inboxes.encode(message.adminList, writer.uint32(18).fork()).ldelim(); } if (message.superAdminList !== undefined) { Inboxes.encode(message.superAdminList, writer.uint32(26).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 = createBaseGroupMutableMetadataV1(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: if (tag !== 10) { break; } const entry1 = GroupMutableMetadataV1_AttributesEntry.decode(reader, reader.uint32()); if (entry1.value !== undefined) { message.attributes[entry1.key] = entry1.value; } continue; case 2: if (tag !== 18) { break; } message.adminList = Inboxes.decode(reader, reader.uint32()); continue; case 3: if (tag !== 26) { break; } message.superAdminList = Inboxes.decode(reader, reader.uint32()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } reader.skipType(tag & 7); } return message; }, fromJSON(object) { return { attributes: isObject(object.attributes) ? Object.entries(object.attributes).reduce((acc, [key, value]) => { acc[key] = String(value); return acc; }, {}) : {}, adminList: isSet(object.adminList) ? Inboxes.fromJSON(object.adminList) : undefined, superAdminList: isSet(object.superAdminList) ? Inboxes.fromJSON(object.superAdminList) : undefined, }; }, toJSON(message) { const obj = {}; if (message.attributes) { const entries = Object.entries(message.attributes); if (entries.length > 0) { obj.attributes = {}; entries.forEach(([k, v]) => { obj.attributes[k] = v; }); } } if (message.adminList !== undefined) { obj.adminList = Inboxes.toJSON(message.adminList); } if (message.superAdminList !== undefined) { obj.superAdminList = Inboxes.toJSON(message.superAdminList); } return obj; }, create(base) { return GroupMutableMetadataV1.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseGroupMutableMetadataV1(); message.attributes = Object.entries(object.attributes ?? {}).reduce((acc, [key, value]) => { if (value !== undefined) { acc[key] = globalThis.String(value); } return acc; }, {}); message.adminList = (object.adminList !== undefined && object.adminList !== null) ? Inboxes.fromPartial(object.adminList) : undefined; message.superAdminList = (object.superAdminList !== undefined && object.superAdminList !== null) ? Inboxes.fromPartial(object.superAdminList) : undefined; return message; }, }; function createBaseGroupMutableMetadataV1_AttributesEntry() { return { key: "", value: "" }; } export const GroupMutableMetadataV1_AttributesEntry = { encode(message, writer = _m0.Writer.create()) { if (message.key !== "") { writer.uint32(10).string(message.key); } if (message.value !== "") { writer.uint32(18).string(message.value); } 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 = createBaseGroupMutableMetadataV1_AttributesEntry(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: if (tag !== 10) { break; } message.key = reader.string(); continue; case 2: if (tag !== 18) { break; } message.value = reader.string(); continue; } if ((tag & 7) === 4 || tag === 0) { break; } reader.skipType(tag & 7); } return message; }, fromJSON(object) { return { key: isSet(object.key) ? globalThis.String(object.key) : "", value: isSet(object.value) ? globalThis.String(object.value) : "", }; }, toJSON(message) { const obj = {}; if (message.key !== "") { obj.key = message.key; } if (message.value !== "") { obj.value = message.value; } return obj; }, create(base) { return GroupMutableMetadataV1_AttributesEntry.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseGroupMutableMetadataV1_AttributesEntry(); message.key = object.key ?? ""; message.value = object.value ?? ""; return message; }, }; function createBaseInboxes() { return { inboxIds: [] }; } export const Inboxes = { encode(message, writer = _m0.Writer.create()) { for (const v of message.inboxIds) { writer.uint32(10).string(v); } 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 = createBaseInboxes(); while (reader.pos < end) { const tag = reader.uint32(); switch (tag >>> 3) { case 1: if (tag !== 10) { break; } message.inboxIds.push(reader.string()); continue; } if ((tag & 7) === 4 || tag === 0) { break; } reader.skipType(tag & 7); } return message; }, fromJSON(object) { return { inboxIds: globalThis.Array.isArray(object?.inboxIds) ? object.inboxIds.map((e) => globalThis.String(e)) : [], }; }, toJSON(message) { const obj = {}; if (message.inboxIds?.length) { obj.inboxIds = message.inboxIds; } return obj; }, create(base) { return Inboxes.fromPartial(base ?? {}); }, fromPartial(object) { const message = createBaseInboxes(); message.inboxIds = object.inboxIds?.map((e) => e) || []; return message; }, }; if (_m0.util.Long !== Long) { _m0.util.Long = Long; _m0.configure(); } function isObject(value) { return typeof value === "object" && value !== null; } function isSet(value) { return value !== null && value !== undefined; }