Developer SDK

Go examples

Install the SDK · View source on GitHub ↗

messages/subprotocol/notes.pb.go

go
// The protobuf protocol of SUBPROTOCOLS.md: an application protocol on
// subprotocol 4097 in which every message is one Envelope.

// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// 	protoc-gen-go v1.36.11
// 	protoc        v7.36.1
// source: notes.proto

// The package name is not on the wire. The examples keep it short; an
// application uses a package of its own.

package subprotocol

import (
	protoreflect "google.golang.org/protobuf/reflect/protoreflect"
	protoimpl "google.golang.org/protobuf/runtime/protoimpl"
	reflect "reflect"
	sync "sync"
	unsafe "unsafe"
)

const (
	// Verify that this generated code is sufficiently up-to-date.
	_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
	// Verify that runtime/protoimpl is sufficiently up-to-date.
	_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)

// One message of the protocol. Exactly one kind is set. A receiver drops an
// envelope with no kind it knows, which is also how a kind added by a later
// version reaches it.
type Envelope struct {
	state protoimpl.MessageState `protogen:"open.v1"`
	// Types that are valid to be assigned to Kind:
	//
	//	*Envelope_Note
	//	*Envelope_Ack
	Kind          isEnvelope_Kind `protobuf_oneof:"kind"`
	unknownFields protoimpl.UnknownFields
	sizeCache     protoimpl.SizeCache
}

func (x *Envelope) Reset() {
	*x = Envelope{}
	mi := &file_notes_proto_msgTypes[0]
	ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
	ms.StoreMessageInfo(mi)
}

func (x *Envelope) String() string {
	return protoimpl.X.MessageStringOf(x)
}

func (*Envelope) ProtoMessage() {}

func (x *Envelope) ProtoReflect() protoreflect.Message {
	mi := &file_notes_proto_msgTypes[0]
	if x != nil {
		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
		if ms.LoadMessageInfo() == nil {
			ms.StoreMessageInfo(mi)
		}
		return ms
	}
	return mi.MessageOf(x)
}

// Deprecated: Use Envelope.ProtoReflect.Descriptor instead.
func (*Envelope) Descriptor() ([]byte, []int) {
	return file_notes_proto_rawDescGZIP(), []int{0}
}

func (x *Envelope) GetKind() isEnvelope_Kind {
	if x != nil {
		return x.Kind
	}
	return nil
}

func (x *Envelope) GetNote() *Note {
	if x != nil {
		if x, ok := x.Kind.(*Envelope_Note); ok {
			return x.Note
		}
	}
	return nil
}

func (x *Envelope) GetAck() *Ack {
	if x != nil {
		if x, ok := x.Kind.(*Envelope_Ack); ok {
			return x.Ack
		}
	}
	return nil
}

type isEnvelope_Kind interface {
	isEnvelope_Kind()
}

type Envelope_Note struct {
	Note *Note `protobuf:"bytes,1,opt,name=note,proto3,oneof"`
}

type Envelope_Ack struct {
	Ack *Ack `protobuf:"bytes,2,opt,name=ack,proto3,oneof"`
}

func (*Envelope_Note) isEnvelope_Kind() {}

func (*Envelope_Ack) isEnvelope_Kind() {}

// Application text. The sender picks message_id: nonzero, kept when the same
// note is sent again, and not reused while an earlier note to the same peer is
// unacknowledged. text is at most 4096 UTF-8 bytes.
type Note struct {
	state         protoimpl.MessageState `protogen:"open.v1"`
	MessageId     uint64                 `protobuf:"varint,1,opt,name=message_id,json=messageId,proto3" json:"message_id,omitempty"`
	Text          string                 `protobuf:"bytes,2,opt,name=text,proto3" json:"text,omitempty"`
	unknownFields protoimpl.UnknownFields
	sizeCache     protoimpl.SizeCache
}

func (x *Note) Reset() {
	*x = Note{}
	mi := &file_notes_proto_msgTypes[1]
	ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
	ms.StoreMessageInfo(mi)
}

func (x *Note) String() string {
	return protoimpl.X.MessageStringOf(x)
}

func (*Note) ProtoMessage() {}

func (x *Note) ProtoReflect() protoreflect.Message {
	mi := &file_notes_proto_msgTypes[1]
	if x != nil {
		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
		if ms.LoadMessageInfo() == nil {
			ms.StoreMessageInfo(mi)
		}
		return ms
	}
	return mi.MessageOf(x)
}

// Deprecated: Use Note.ProtoReflect.Descriptor instead.
func (*Note) Descriptor() ([]byte, []int) {
	return file_notes_proto_rawDescGZIP(), []int{1}
}

func (x *Note) GetMessageId() uint64 {
	if x != nil {
		return x.MessageId
	}
	return 0
}

func (x *Note) GetText() string {
	if x != nil {
		return x.Text
	}
	return ""
}

// The receiver parsed and accepted the note with this message_id. It is sent
// to the note's source and is never itself acknowledged.
type Ack struct {
	state         protoimpl.MessageState `protogen:"open.v1"`
	MessageId     uint64                 `protobuf:"varint,1,opt,name=message_id,json=messageId,proto3" json:"message_id,omitempty"`
	unknownFields protoimpl.UnknownFields
	sizeCache     protoimpl.SizeCache
}

func (x *Ack) Reset() {
	*x = Ack{}
	mi := &file_notes_proto_msgTypes[2]
	ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
	ms.StoreMessageInfo(mi)
}

func (x *Ack) String() string {
	return protoimpl.X.MessageStringOf(x)
}

func (*Ack) ProtoMessage() {}

func (x *Ack) ProtoReflect() protoreflect.Message {
	mi := &file_notes_proto_msgTypes[2]
	if x != nil {
		ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
		if ms.LoadMessageInfo() == nil {
			ms.StoreMessageInfo(mi)
		}
		return ms
	}
	return mi.MessageOf(x)
}

// Deprecated: Use Ack.ProtoReflect.Descriptor instead.
func (*Ack) Descriptor() ([]byte, []int) {
	return file_notes_proto_rawDescGZIP(), []int{2}
}

func (x *Ack) GetMessageId() uint64 {
	if x != nil {
		return x.MessageId
	}
	return 0
}

var File_notes_proto protoreflect.FileDescriptor

const file_notes_proto_rawDesc = "" +
	"\n" +
	"\vnotes.proto\x12\bnotes.v1\"[\n" +
	"\bEnvelope\x12$\n" +
	"\x04note\x18\x01 \x01(\v2\x0e.notes.v1.NoteH\x00R\x04note\x12!\n" +
	"\x03ack\x18\x02 \x01(\v2\r.notes.v1.AckH\x00R\x03ackB\x06\n" +
	"\x04kind\"9\n" +
	"\x04Note\x12\x1d\n" +
	"\n" +
	"message_id\x18\x01 \x01(\x04R\tmessageId\x12\x12\n" +
	"\x04text\x18\x02 \x01(\tR\x04text\"$\n" +
	"\x03Ack\x12\x1d\n" +
	"\n" +
	"message_id\x18\x01 \x01(\x04R\tmessageIdBO\n" +
	"\x14io.ur.examples.notesP\x01Z5github.com/urnetwork/examples/go/messages/subprotocolb\x06proto3"

var (
	file_notes_proto_rawDescOnce sync.Once
	file_notes_proto_rawDescData []byte
)

func file_notes_proto_rawDescGZIP() []byte {
	file_notes_proto_rawDescOnce.Do(func() {
		file_notes_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_notes_proto_rawDesc), len(file_notes_proto_rawDesc)))
	})
	return file_notes_proto_rawDescData
}

var file_notes_proto_msgTypes = make([]protoimpl.MessageInfo, 3)
var file_notes_proto_goTypes = []any{
	(*Envelope)(nil), // 0: notes.v1.Envelope
	(*Note)(nil),     // 1: notes.v1.Note
	(*Ack)(nil),      // 2: notes.v1.Ack
}
var file_notes_proto_depIdxs = []int32{
	1, // 0: notes.v1.Envelope.note:type_name -> notes.v1.Note
	2, // 1: notes.v1.Envelope.ack:type_name -> notes.v1.Ack
	2, // [2:2] is the sub-list for method output_type
	2, // [2:2] is the sub-list for method input_type
	2, // [2:2] is the sub-list for extension type_name
	2, // [2:2] is the sub-list for extension extendee
	0, // [0:2] is the sub-list for field type_name
}

func init() { file_notes_proto_init() }
func file_notes_proto_init() {
	if File_notes_proto != nil {
		return
	}
	file_notes_proto_msgTypes[0].OneofWrappers = []any{
		(*Envelope_Note)(nil),
		(*Envelope_Ack)(nil),
	}
	type x struct{}
	out := protoimpl.TypeBuilder{
		File: protoimpl.DescBuilder{
			GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
			RawDescriptor: unsafe.Slice(unsafe.StringData(file_notes_proto_rawDesc), len(file_notes_proto_rawDesc)),
			NumEnums:      0,
			NumMessages:   3,
			NumExtensions: 0,
			NumServices:   0,
		},
		GoTypes:           file_notes_proto_goTypes,
		DependencyIndexes: file_notes_proto_depIdxs,
		MessageInfos:      file_notes_proto_msgTypes,
	}.Build()
	File_notes_proto = out.File
	file_notes_proto_goTypes = nil
	file_notes_proto_depIdxs = nil
}