173 lines
5.5 KiB
Go
173 lines
5.5 KiB
Go
|
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||
|
// versions:
|
||
|
// - protoc-gen-go-grpc v1.3.0
|
||
|
// - protoc (unknown)
|
||
|
// source: notes/v1/notes.proto
|
||
|
|
||
|
package notesv1
|
||
|
|
||
|
import (
|
||
|
context "context"
|
||
|
grpc "google.golang.org/grpc"
|
||
|
codes "google.golang.org/grpc/codes"
|
||
|
status "google.golang.org/grpc/status"
|
||
|
)
|
||
|
|
||
|
// This is a compile-time assertion to ensure that this generated file
|
||
|
// is compatible with the grpc package it is being compiled against.
|
||
|
// Requires gRPC-Go v1.32.0 or later.
|
||
|
const _ = grpc.SupportPackageIsVersion7
|
||
|
|
||
|
const (
|
||
|
NotesService_ListNotes_FullMethodName = "/notes.v1.NotesService/ListNotes"
|
||
|
NotesService_AddNote_FullMethodName = "/notes.v1.NotesService/AddNote"
|
||
|
)
|
||
|
|
||
|
// NotesServiceClient is the client API for NotesService service.
|
||
|
//
|
||
|
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||
|
type NotesServiceClient interface {
|
||
|
ListNotes(ctx context.Context, in *ListNotesRequest, opts ...grpc.CallOption) (NotesService_ListNotesClient, error)
|
||
|
AddNote(ctx context.Context, in *AddNoteRequest, opts ...grpc.CallOption) (*AddNoteResponse, error)
|
||
|
}
|
||
|
|
||
|
type notesServiceClient struct {
|
||
|
cc grpc.ClientConnInterface
|
||
|
}
|
||
|
|
||
|
func NewNotesServiceClient(cc grpc.ClientConnInterface) NotesServiceClient {
|
||
|
return ¬esServiceClient{cc}
|
||
|
}
|
||
|
|
||
|
func (c *notesServiceClient) ListNotes(ctx context.Context, in *ListNotesRequest, opts ...grpc.CallOption) (NotesService_ListNotesClient, error) {
|
||
|
stream, err := c.cc.NewStream(ctx, &NotesService_ServiceDesc.Streams[0], NotesService_ListNotes_FullMethodName, opts...)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
x := ¬esServiceListNotesClient{stream}
|
||
|
if err := x.ClientStream.SendMsg(in); err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
if err := x.ClientStream.CloseSend(); err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
return x, nil
|
||
|
}
|
||
|
|
||
|
type NotesService_ListNotesClient interface {
|
||
|
Recv() (*ListNotesResponse, error)
|
||
|
grpc.ClientStream
|
||
|
}
|
||
|
|
||
|
type notesServiceListNotesClient struct {
|
||
|
grpc.ClientStream
|
||
|
}
|
||
|
|
||
|
func (x *notesServiceListNotesClient) Recv() (*ListNotesResponse, error) {
|
||
|
m := new(ListNotesResponse)
|
||
|
if err := x.ClientStream.RecvMsg(m); err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
return m, nil
|
||
|
}
|
||
|
|
||
|
func (c *notesServiceClient) AddNote(ctx context.Context, in *AddNoteRequest, opts ...grpc.CallOption) (*AddNoteResponse, error) {
|
||
|
out := new(AddNoteResponse)
|
||
|
err := c.cc.Invoke(ctx, NotesService_AddNote_FullMethodName, in, out, opts...)
|
||
|
if err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
return out, nil
|
||
|
}
|
||
|
|
||
|
// NotesServiceServer is the server API for NotesService service.
|
||
|
// All implementations should embed UnimplementedNotesServiceServer
|
||
|
// for forward compatibility
|
||
|
type NotesServiceServer interface {
|
||
|
ListNotes(*ListNotesRequest, NotesService_ListNotesServer) error
|
||
|
AddNote(context.Context, *AddNoteRequest) (*AddNoteResponse, error)
|
||
|
}
|
||
|
|
||
|
// UnimplementedNotesServiceServer should be embedded to have forward compatible implementations.
|
||
|
type UnimplementedNotesServiceServer struct {
|
||
|
}
|
||
|
|
||
|
func (UnimplementedNotesServiceServer) ListNotes(*ListNotesRequest, NotesService_ListNotesServer) error {
|
||
|
return status.Errorf(codes.Unimplemented, "method ListNotes not implemented")
|
||
|
}
|
||
|
func (UnimplementedNotesServiceServer) AddNote(context.Context, *AddNoteRequest) (*AddNoteResponse, error) {
|
||
|
return nil, status.Errorf(codes.Unimplemented, "method AddNote not implemented")
|
||
|
}
|
||
|
|
||
|
// UnsafeNotesServiceServer may be embedded to opt out of forward compatibility for this service.
|
||
|
// Use of this interface is not recommended, as added methods to NotesServiceServer will
|
||
|
// result in compilation errors.
|
||
|
type UnsafeNotesServiceServer interface {
|
||
|
mustEmbedUnimplementedNotesServiceServer()
|
||
|
}
|
||
|
|
||
|
func RegisterNotesServiceServer(s grpc.ServiceRegistrar, srv NotesServiceServer) {
|
||
|
s.RegisterService(&NotesService_ServiceDesc, srv)
|
||
|
}
|
||
|
|
||
|
func _NotesService_ListNotes_Handler(srv interface{}, stream grpc.ServerStream) error {
|
||
|
m := new(ListNotesRequest)
|
||
|
if err := stream.RecvMsg(m); err != nil {
|
||
|
return err
|
||
|
}
|
||
|
return srv.(NotesServiceServer).ListNotes(m, ¬esServiceListNotesServer{stream})
|
||
|
}
|
||
|
|
||
|
type NotesService_ListNotesServer interface {
|
||
|
Send(*ListNotesResponse) error
|
||
|
grpc.ServerStream
|
||
|
}
|
||
|
|
||
|
type notesServiceListNotesServer struct {
|
||
|
grpc.ServerStream
|
||
|
}
|
||
|
|
||
|
func (x *notesServiceListNotesServer) Send(m *ListNotesResponse) error {
|
||
|
return x.ServerStream.SendMsg(m)
|
||
|
}
|
||
|
|
||
|
func _NotesService_AddNote_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||
|
in := new(AddNoteRequest)
|
||
|
if err := dec(in); err != nil {
|
||
|
return nil, err
|
||
|
}
|
||
|
if interceptor == nil {
|
||
|
return srv.(NotesServiceServer).AddNote(ctx, in)
|
||
|
}
|
||
|
info := &grpc.UnaryServerInfo{
|
||
|
Server: srv,
|
||
|
FullMethod: NotesService_AddNote_FullMethodName,
|
||
|
}
|
||
|
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||
|
return srv.(NotesServiceServer).AddNote(ctx, req.(*AddNoteRequest))
|
||
|
}
|
||
|
return interceptor(ctx, in, info, handler)
|
||
|
}
|
||
|
|
||
|
// NotesService_ServiceDesc is the grpc.ServiceDesc for NotesService service.
|
||
|
// It's only intended for direct use with grpc.RegisterService,
|
||
|
// and not to be introspected or modified (even as a copy)
|
||
|
var NotesService_ServiceDesc = grpc.ServiceDesc{
|
||
|
ServiceName: "notes.v1.NotesService",
|
||
|
HandlerType: (*NotesServiceServer)(nil),
|
||
|
Methods: []grpc.MethodDesc{
|
||
|
{
|
||
|
MethodName: "AddNote",
|
||
|
Handler: _NotesService_AddNote_Handler,
|
||
|
},
|
||
|
},
|
||
|
Streams: []grpc.StreamDesc{
|
||
|
{
|
||
|
StreamName: "ListNotes",
|
||
|
Handler: _NotesService_ListNotes_Handler,
|
||
|
ServerStreams: true,
|
||
|
},
|
||
|
},
|
||
|
Metadata: "notes/v1/notes.proto",
|
||
|
}
|