protobuf definitions for hyper-real-time chat

add mediainit + mediapub

+375 -3
+173 -3
gen/go/lrc.pb.go
··· 1217 1217 return nil 1218 1218 } 1219 1219 1220 + type MediaInit struct { 1221 + state protoimpl.MessageState `protogen:"open.v1"` 1222 + Id *uint32 `protobuf:"varint,1,opt,name=id,proto3,oneof" json:"id,omitempty"` 1223 + Nick *string `protobuf:"bytes,2,opt,name=nick,proto3,oneof" json:"nick,omitempty"` 1224 + ExternalID *string `protobuf:"bytes,3,opt,name=externalID,proto3,oneof" json:"externalID,omitempty"` 1225 + Color *uint32 `protobuf:"varint,4,opt,name=color,proto3,oneof" json:"color,omitempty"` 1226 + Echoed *bool `protobuf:"varint,5,opt,name=echoed,proto3,oneof" json:"echoed,omitempty"` 1227 + Nonce []byte `protobuf:"bytes,6,opt,name=nonce,proto3,oneof" json:"nonce,omitempty"` 1228 + unknownFields protoimpl.UnknownFields 1229 + sizeCache protoimpl.SizeCache 1230 + } 1231 + 1232 + func (x *MediaInit) Reset() { 1233 + *x = MediaInit{} 1234 + mi := &file_lrc_proto_msgTypes[18] 1235 + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 1236 + ms.StoreMessageInfo(mi) 1237 + } 1238 + 1239 + func (x *MediaInit) String() string { 1240 + return protoimpl.X.MessageStringOf(x) 1241 + } 1242 + 1243 + func (*MediaInit) ProtoMessage() {} 1244 + 1245 + func (x *MediaInit) ProtoReflect() protoreflect.Message { 1246 + mi := &file_lrc_proto_msgTypes[18] 1247 + if x != nil { 1248 + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 1249 + if ms.LoadMessageInfo() == nil { 1250 + ms.StoreMessageInfo(mi) 1251 + } 1252 + return ms 1253 + } 1254 + return mi.MessageOf(x) 1255 + } 1256 + 1257 + // Deprecated: Use MediaInit.ProtoReflect.Descriptor instead. 1258 + func (*MediaInit) Descriptor() ([]byte, []int) { 1259 + return file_lrc_proto_rawDescGZIP(), []int{18} 1260 + } 1261 + 1262 + func (x *MediaInit) GetId() uint32 { 1263 + if x != nil && x.Id != nil { 1264 + return *x.Id 1265 + } 1266 + return 0 1267 + } 1268 + 1269 + func (x *MediaInit) GetNick() string { 1270 + if x != nil && x.Nick != nil { 1271 + return *x.Nick 1272 + } 1273 + return "" 1274 + } 1275 + 1276 + func (x *MediaInit) GetExternalID() string { 1277 + if x != nil && x.ExternalID != nil { 1278 + return *x.ExternalID 1279 + } 1280 + return "" 1281 + } 1282 + 1283 + func (x *MediaInit) GetColor() uint32 { 1284 + if x != nil && x.Color != nil { 1285 + return *x.Color 1286 + } 1287 + return 0 1288 + } 1289 + 1290 + func (x *MediaInit) GetEchoed() bool { 1291 + if x != nil && x.Echoed != nil { 1292 + return *x.Echoed 1293 + } 1294 + return false 1295 + } 1296 + 1297 + func (x *MediaInit) GetNonce() []byte { 1298 + if x != nil { 1299 + return x.Nonce 1300 + } 1301 + return nil 1302 + } 1303 + 1304 + type MediaPub struct { 1305 + state protoimpl.MessageState `protogen:"open.v1"` 1306 + Id *uint32 `protobuf:"varint,1,opt,name=id,proto3,oneof" json:"id,omitempty"` 1307 + ContentAddress *string `protobuf:"bytes,2,opt,name=contentAddress,proto3,oneof" json:"contentAddress,omitempty"` 1308 + Alt *string `protobuf:"bytes,3,opt,name=alt,proto3,oneof" json:"alt,omitempty"` 1309 + unknownFields protoimpl.UnknownFields 1310 + sizeCache protoimpl.SizeCache 1311 + } 1312 + 1313 + func (x *MediaPub) Reset() { 1314 + *x = MediaPub{} 1315 + mi := &file_lrc_proto_msgTypes[19] 1316 + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 1317 + ms.StoreMessageInfo(mi) 1318 + } 1319 + 1320 + func (x *MediaPub) String() string { 1321 + return protoimpl.X.MessageStringOf(x) 1322 + } 1323 + 1324 + func (*MediaPub) ProtoMessage() {} 1325 + 1326 + func (x *MediaPub) ProtoReflect() protoreflect.Message { 1327 + mi := &file_lrc_proto_msgTypes[19] 1328 + if x != nil { 1329 + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) 1330 + if ms.LoadMessageInfo() == nil { 1331 + ms.StoreMessageInfo(mi) 1332 + } 1333 + return ms 1334 + } 1335 + return mi.MessageOf(x) 1336 + } 1337 + 1338 + // Deprecated: Use MediaPub.ProtoReflect.Descriptor instead. 1339 + func (*MediaPub) Descriptor() ([]byte, []int) { 1340 + return file_lrc_proto_rawDescGZIP(), []int{19} 1341 + } 1342 + 1343 + func (x *MediaPub) GetId() uint32 { 1344 + if x != nil && x.Id != nil { 1345 + return *x.Id 1346 + } 1347 + return 0 1348 + } 1349 + 1350 + func (x *MediaPub) GetContentAddress() string { 1351 + if x != nil && x.ContentAddress != nil { 1352 + return *x.ContentAddress 1353 + } 1354 + return "" 1355 + } 1356 + 1357 + func (x *MediaPub) GetAlt() string { 1358 + if x != nil && x.Alt != nil { 1359 + return *x.Alt 1360 + } 1361 + return "" 1362 + } 1363 + 1220 1364 var File_lrc_proto protoreflect.FileDescriptor 1221 1365 1222 1366 const file_lrc_proto_rawDesc = "" + ··· 1322 1466 "\x06delete\x18\x02 \x01(\v2\x0e.lrc.v1.DeleteH\x00R\x06deleteB\x06\n" + 1323 1467 "\x04edit\"/\n" + 1324 1468 "\tEditBatch\x12\"\n" + 1325 - "\x05edits\x18\x01 \x03(\v2\f.lrc.v1.EditR\x05editsB3Z1github.com/rachel-mp4/lrcproto/gen/go/lrcpb;lrcpbb\x06proto3" 1469 + "\x05edits\x18\x01 \x03(\v2\f.lrc.v1.EditR\x05edits\"\xef\x01\n" + 1470 + "\tMediaInit\x12\x13\n" + 1471 + "\x02id\x18\x01 \x01(\rH\x00R\x02id\x88\x01\x01\x12\x17\n" + 1472 + "\x04nick\x18\x02 \x01(\tH\x01R\x04nick\x88\x01\x01\x12#\n" + 1473 + "\n" + 1474 + "externalID\x18\x03 \x01(\tH\x02R\n" + 1475 + "externalID\x88\x01\x01\x12\x19\n" + 1476 + "\x05color\x18\x04 \x01(\rH\x03R\x05color\x88\x01\x01\x12\x1b\n" + 1477 + "\x06echoed\x18\x05 \x01(\bH\x04R\x06echoed\x88\x01\x01\x12\x19\n" + 1478 + "\x05nonce\x18\x06 \x01(\fH\x05R\x05nonce\x88\x01\x01B\x05\n" + 1479 + "\x03_idB\a\n" + 1480 + "\x05_nickB\r\n" + 1481 + "\v_externalIDB\b\n" + 1482 + "\x06_colorB\t\n" + 1483 + "\a_echoedB\b\n" + 1484 + "\x06_nonce\"\x85\x01\n" + 1485 + "\bMediaPub\x12\x13\n" + 1486 + "\x02id\x18\x01 \x01(\rH\x00R\x02id\x88\x01\x01\x12+\n" + 1487 + "\x0econtentAddress\x18\x02 \x01(\tH\x01R\x0econtentAddress\x88\x01\x01\x12\x15\n" + 1488 + "\x03alt\x18\x03 \x01(\tH\x02R\x03alt\x88\x01\x01B\x05\n" + 1489 + "\x03_idB\x11\n" + 1490 + "\x0f_contentAddressB\x06\n" + 1491 + "\x04_altB3Z1github.com/rachel-mp4/lrcproto/gen/go/lrcpb;lrcpbb\x06proto3" 1326 1492 1327 1493 var ( 1328 1494 file_lrc_proto_rawDescOnce sync.Once ··· 1336 1502 return file_lrc_proto_rawDescData 1337 1503 } 1338 1504 1339 - var file_lrc_proto_msgTypes = make([]protoimpl.MessageInfo, 18) 1505 + var file_lrc_proto_msgTypes = make([]protoimpl.MessageInfo, 20) 1340 1506 var file_lrc_proto_goTypes = []any{ 1341 1507 (*Event)(nil), // 0: lrc.v1.Event 1342 1508 (*Ping)(nil), // 1: lrc.v1.Ping ··· 1356 1522 (*Unban)(nil), // 15: lrc.v1.Unban 1357 1523 (*Edit)(nil), // 16: lrc.v1.Edit 1358 1524 (*EditBatch)(nil), // 17: lrc.v1.EditBatch 1525 + (*MediaInit)(nil), // 18: lrc.v1.MediaInit 1526 + (*MediaPub)(nil), // 19: lrc.v1.MediaPub 1359 1527 } 1360 1528 var file_lrc_proto_depIdxs = []int32{ 1361 1529 1, // 0: lrc.v1.Event.ping:type_name -> lrc.v1.Ping ··· 1418 1586 (*Edit_Insert)(nil), 1419 1587 (*Edit_Delete)(nil), 1420 1588 } 1589 + file_lrc_proto_msgTypes[18].OneofWrappers = []any{} 1590 + file_lrc_proto_msgTypes[19].OneofWrappers = []any{} 1421 1591 type x struct{} 1422 1592 out := protoimpl.TypeBuilder{ 1423 1593 File: protoimpl.DescBuilder{ 1424 1594 GoPackagePath: reflect.TypeOf(x{}).PkgPath(), 1425 1595 RawDescriptor: unsafe.Slice(unsafe.StringData(file_lrc_proto_rawDesc), len(file_lrc_proto_rawDesc)), 1426 1596 NumEnums: 0, 1427 - NumMessages: 18, 1597 + NumMessages: 20, 1428 1598 NumExtensions: 0, 1429 1599 NumServices: 0, 1430 1600 },
+187
gen/ts/lrc.ts
··· 338 338 */ 339 339 edits: Edit[]; 340 340 } 341 + /** 342 + * @generated from protobuf message lrc.v1.MediaInit 343 + */ 344 + export interface MediaInit { 345 + /** 346 + * @generated from protobuf field: optional uint32 id = 1; 347 + */ 348 + id?: number; 349 + /** 350 + * @generated from protobuf field: optional string nick = 2; 351 + */ 352 + nick?: string; 353 + /** 354 + * @generated from protobuf field: optional string externalID = 3; 355 + */ 356 + externalID?: string; 357 + /** 358 + * @generated from protobuf field: optional uint32 color = 4; 359 + */ 360 + color?: number; 361 + /** 362 + * @generated from protobuf field: optional bool echoed = 5; 363 + */ 364 + echoed?: boolean; 365 + /** 366 + * @generated from protobuf field: optional bytes nonce = 6; 367 + */ 368 + nonce?: Uint8Array; 369 + } 370 + /** 371 + * @generated from protobuf message lrc.v1.MediaPub 372 + */ 373 + export interface MediaPub { 374 + /** 375 + * @generated from protobuf field: optional uint32 id = 1; 376 + */ 377 + id?: number; 378 + /** 379 + * @generated from protobuf field: optional string contentAddress = 2; 380 + */ 381 + contentAddress?: string; 382 + /** 383 + * @generated from protobuf field: optional string alt = 3; 384 + */ 385 + alt?: string; 386 + } 341 387 // @generated message type with reflection information, may provide speed optimized methods 342 388 class Event$Type extends MessageType<Event> { 343 389 constructor() { ··· 1440 1486 * @generated MessageType for protobuf message lrc.v1.EditBatch 1441 1487 */ 1442 1488 export const EditBatch = new EditBatch$Type(); 1489 + // @generated message type with reflection information, may provide speed optimized methods 1490 + class MediaInit$Type extends MessageType<MediaInit> { 1491 + constructor() { 1492 + super("lrc.v1.MediaInit", [ 1493 + { no: 1, name: "id", kind: "scalar", opt: true, T: 13 /*ScalarType.UINT32*/ }, 1494 + { no: 2, name: "nick", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ }, 1495 + { no: 3, name: "externalID", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ }, 1496 + { no: 4, name: "color", kind: "scalar", opt: true, T: 13 /*ScalarType.UINT32*/ }, 1497 + { no: 5, name: "echoed", kind: "scalar", opt: true, T: 8 /*ScalarType.BOOL*/ }, 1498 + { no: 6, name: "nonce", kind: "scalar", opt: true, T: 12 /*ScalarType.BYTES*/ } 1499 + ]); 1500 + } 1501 + create(value?: PartialMessage<MediaInit>): MediaInit { 1502 + const message = globalThis.Object.create((this.messagePrototype!)); 1503 + if (value !== undefined) 1504 + reflectionMergePartial<MediaInit>(this, message, value); 1505 + return message; 1506 + } 1507 + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: MediaInit): MediaInit { 1508 + let message = target ?? this.create(), end = reader.pos + length; 1509 + while (reader.pos < end) { 1510 + let [fieldNo, wireType] = reader.tag(); 1511 + switch (fieldNo) { 1512 + case /* optional uint32 id */ 1: 1513 + message.id = reader.uint32(); 1514 + break; 1515 + case /* optional string nick */ 2: 1516 + message.nick = reader.string(); 1517 + break; 1518 + case /* optional string externalID */ 3: 1519 + message.externalID = reader.string(); 1520 + break; 1521 + case /* optional uint32 color */ 4: 1522 + message.color = reader.uint32(); 1523 + break; 1524 + case /* optional bool echoed */ 5: 1525 + message.echoed = reader.bool(); 1526 + break; 1527 + case /* optional bytes nonce */ 6: 1528 + message.nonce = reader.bytes(); 1529 + break; 1530 + default: 1531 + let u = options.readUnknownField; 1532 + if (u === "throw") 1533 + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); 1534 + let d = reader.skip(wireType); 1535 + if (u !== false) 1536 + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); 1537 + } 1538 + } 1539 + return message; 1540 + } 1541 + internalBinaryWrite(message: MediaInit, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { 1542 + /* optional uint32 id = 1; */ 1543 + if (message.id !== undefined) 1544 + writer.tag(1, WireType.Varint).uint32(message.id); 1545 + /* optional string nick = 2; */ 1546 + if (message.nick !== undefined) 1547 + writer.tag(2, WireType.LengthDelimited).string(message.nick); 1548 + /* optional string externalID = 3; */ 1549 + if (message.externalID !== undefined) 1550 + writer.tag(3, WireType.LengthDelimited).string(message.externalID); 1551 + /* optional uint32 color = 4; */ 1552 + if (message.color !== undefined) 1553 + writer.tag(4, WireType.Varint).uint32(message.color); 1554 + /* optional bool echoed = 5; */ 1555 + if (message.echoed !== undefined) 1556 + writer.tag(5, WireType.Varint).bool(message.echoed); 1557 + /* optional bytes nonce = 6; */ 1558 + if (message.nonce !== undefined) 1559 + writer.tag(6, WireType.LengthDelimited).bytes(message.nonce); 1560 + let u = options.writeUnknownFields; 1561 + if (u !== false) 1562 + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); 1563 + return writer; 1564 + } 1565 + } 1566 + /** 1567 + * @generated MessageType for protobuf message lrc.v1.MediaInit 1568 + */ 1569 + export const MediaInit = new MediaInit$Type(); 1570 + // @generated message type with reflection information, may provide speed optimized methods 1571 + class MediaPub$Type extends MessageType<MediaPub> { 1572 + constructor() { 1573 + super("lrc.v1.MediaPub", [ 1574 + { no: 1, name: "id", kind: "scalar", opt: true, T: 13 /*ScalarType.UINT32*/ }, 1575 + { no: 2, name: "contentAddress", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ }, 1576 + { no: 3, name: "alt", kind: "scalar", opt: true, T: 9 /*ScalarType.STRING*/ } 1577 + ]); 1578 + } 1579 + create(value?: PartialMessage<MediaPub>): MediaPub { 1580 + const message = globalThis.Object.create((this.messagePrototype!)); 1581 + if (value !== undefined) 1582 + reflectionMergePartial<MediaPub>(this, message, value); 1583 + return message; 1584 + } 1585 + internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: MediaPub): MediaPub { 1586 + let message = target ?? this.create(), end = reader.pos + length; 1587 + while (reader.pos < end) { 1588 + let [fieldNo, wireType] = reader.tag(); 1589 + switch (fieldNo) { 1590 + case /* optional uint32 id */ 1: 1591 + message.id = reader.uint32(); 1592 + break; 1593 + case /* optional string contentAddress */ 2: 1594 + message.contentAddress = reader.string(); 1595 + break; 1596 + case /* optional string alt */ 3: 1597 + message.alt = reader.string(); 1598 + break; 1599 + default: 1600 + let u = options.readUnknownField; 1601 + if (u === "throw") 1602 + throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`); 1603 + let d = reader.skip(wireType); 1604 + if (u !== false) 1605 + (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d); 1606 + } 1607 + } 1608 + return message; 1609 + } 1610 + internalBinaryWrite(message: MediaPub, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter { 1611 + /* optional uint32 id = 1; */ 1612 + if (message.id !== undefined) 1613 + writer.tag(1, WireType.Varint).uint32(message.id); 1614 + /* optional string contentAddress = 2; */ 1615 + if (message.contentAddress !== undefined) 1616 + writer.tag(2, WireType.LengthDelimited).string(message.contentAddress); 1617 + /* optional string alt = 3; */ 1618 + if (message.alt !== undefined) 1619 + writer.tag(3, WireType.LengthDelimited).string(message.alt); 1620 + let u = options.writeUnknownFields; 1621 + if (u !== false) 1622 + (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer); 1623 + return writer; 1624 + } 1625 + } 1626 + /** 1627 + * @generated MessageType for protobuf message lrc.v1.MediaPub 1628 + */ 1629 + export const MediaPub = new MediaPub$Type();
+15
lrc.proto
··· 95 95 } 96 96 97 97 message EditBatch { repeated Edit edits = 1; } 98 + 99 + message MediaInit { 100 + optional uint32 id = 1; 101 + optional string nick = 2; 102 + optional string externalID = 3; 103 + optional uint32 color = 4; 104 + optional bool echoed = 5; 105 + optional bytes nonce = 6; 106 + } 107 + 108 + message MediaPub { 109 + optional uint32 id = 1; 110 + optional string contentAddress = 2; 111 + optional string alt = 3; 112 + }