diff --git a/api/v2/memo_service.go b/api/v2/memo_service.go new file mode 100644 index 00000000..a6ea4eca --- /dev/null +++ b/api/v2/memo_service.go @@ -0,0 +1,187 @@ +package v2 + +import ( + "context" + "strings" + "time" + + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/types/known/timestamppb" + + apiv2pb "github.com/yourselfhosted/slash/proto/gen/api/v2" + storepb "github.com/yourselfhosted/slash/proto/gen/store" + "github.com/yourselfhosted/slash/store" +) + +func (s *APIV2Service) ListMemos(ctx context.Context, _ *apiv2pb.ListMemosRequest) (*apiv2pb.ListMemosResponse, error) { + find := &store.FindMemo{} + memos, err := s.Store.ListMemos(ctx, find) + if err != nil { + return nil, status.Errorf(codes.Internal, "failed to fetch memo list, err: %v", err) + } + + composedMemos := []*apiv2pb.Memo{} + for _, memo := range memos { + composedMemo, err := s.convertMemoFromStorepb(ctx, memo) + if err != nil { + return nil, status.Errorf(codes.Internal, "failed to convert memo, err: %v", err) + } + composedMemos = append(composedMemos, composedMemo) + } + + response := &apiv2pb.ListMemosResponse{ + Memos: composedMemos, + } + return response, nil +} + +func (s *APIV2Service) GetMemo(ctx context.Context, request *apiv2pb.GetMemoRequest) (*apiv2pb.GetMemoResponse, error) { + memo, err := s.Store.GetMemo(ctx, &store.FindMemo{ + ID: &request.Id, + }) + if err != nil { + return nil, status.Errorf(codes.Internal, "failed to get memo by ID: %v", err) + } + if memo == nil { + return nil, status.Errorf(codes.NotFound, "memo not found") + } + + composedMemo, err := s.convertMemoFromStorepb(ctx, memo) + if err != nil { + return nil, status.Errorf(codes.Internal, "failed to convert memo, err: %v", err) + } + response := &apiv2pb.GetMemoResponse{ + Memo: composedMemo, + } + return response, nil +} + +func (s *APIV2Service) CreateMemo(ctx context.Context, request *apiv2pb.CreateMemoRequest) (*apiv2pb.CreateMemoResponse, error) { + userID := ctx.Value(userIDContextKey).(int32) + memo := &storepb.Memo{ + CreatorId: userID, + Name: request.Memo.Name, + Title: request.Memo.Title, + Content: request.Memo.Content, + Tags: request.Memo.Tags, + Visibility: storepb.Visibility(request.Memo.Visibility), + } + memo, err := s.Store.CreateMemo(ctx, memo) + if err != nil { + return nil, status.Errorf(codes.Internal, "failed to create memo, err: %v", err) + } + + composedMemo, err := s.convertMemoFromStorepb(ctx, memo) + if err != nil { + return nil, status.Errorf(codes.Internal, "failed to convert memo, err: %v", err) + } + response := &apiv2pb.CreateMemoResponse{ + Memo: composedMemo, + } + return response, nil +} + +func (s *APIV2Service) UpdateMemo(ctx context.Context, request *apiv2pb.UpdateMemoRequest) (*apiv2pb.UpdateMemoResponse, error) { + if request.UpdateMask == nil || len(request.UpdateMask.Paths) == 0 { + return nil, status.Errorf(codes.InvalidArgument, "updateMask is required") + } + + userID := ctx.Value(userIDContextKey).(int32) + currentUser, err := s.Store.GetUser(ctx, &store.FindUser{ + ID: &userID, + }) + if err != nil { + return nil, status.Errorf(codes.Internal, "failed to get current user, err: %v", err) + } + memo, err := s.Store.GetMemo(ctx, &store.FindMemo{ + ID: &request.Memo.Id, + }) + if err != nil { + return nil, status.Errorf(codes.Internal, "failed to get memo by ID: %v", err) + } + if memo == nil { + return nil, status.Errorf(codes.NotFound, "memo not found") + } + if memo.CreatorId != userID && currentUser.Role != store.RoleAdmin { + return nil, status.Errorf(codes.PermissionDenied, "Permission denied") + } + + update := &store.UpdateMemo{ + ID: memo.Id, + } + for _, path := range request.UpdateMask.Paths { + switch path { + case "name": + update.Name = &request.Memo.Name + case "title": + update.Title = &request.Memo.Title + case "content": + update.Content = &request.Memo.Content + case "tags": + tag := strings.Join(request.Memo.Tags, " ") + update.Tag = &tag + case "visibility": + visibility := store.Visibility(request.Memo.Visibility.String()) + update.Visibility = &visibility + } + } + memo, err = s.Store.UpdateMemo(ctx, update) + if err != nil { + return nil, status.Errorf(codes.Internal, "failed to update memo, err: %v", err) + } + + composedMemo, err := s.convertMemoFromStorepb(ctx, memo) + if err != nil { + return nil, status.Errorf(codes.Internal, "failed to convert memo, err: %v", err) + } + response := &apiv2pb.UpdateMemoResponse{ + Memo: composedMemo, + } + return response, nil +} + +func (s *APIV2Service) DeleteMemo(ctx context.Context, request *apiv2pb.DeleteMemoRequest) (*apiv2pb.DeleteMemoResponse, error) { + userID := ctx.Value(userIDContextKey).(int32) + currentUser, err := s.Store.GetUser(ctx, &store.FindUser{ + ID: &userID, + }) + if err != nil { + return nil, status.Errorf(codes.Internal, "failed to get current user, err: %v", err) + } + memo, err := s.Store.GetMemo(ctx, &store.FindMemo{ + ID: &request.Id, + }) + if err != nil { + return nil, status.Errorf(codes.Internal, "failed to get memo by ID: %v", err) + } + if memo == nil { + return nil, status.Errorf(codes.NotFound, "memo not found") + } + if memo.CreatorId != userID && currentUser.Role != store.RoleAdmin { + return nil, status.Errorf(codes.PermissionDenied, "Permission denied") + } + + err = s.Store.DeleteMemo(ctx, &store.DeleteMemo{ + ID: memo.Id, + }) + if err != nil { + return nil, status.Errorf(codes.Internal, "failed to delete memo, err: %v", err) + } + response := &apiv2pb.DeleteMemoResponse{} + return response, nil +} + +func (*APIV2Service) convertMemoFromStorepb(_ context.Context, memo *storepb.Memo) (*apiv2pb.Memo, error) { + return &apiv2pb.Memo{ + Id: memo.Id, + CreatedTime: timestamppb.New(time.Unix(memo.CreatedTs, 0)), + UpdatedTime: timestamppb.New(time.Unix(memo.UpdatedTs, 0)), + CreatorId: memo.CreatorId, + Name: memo.Name, + Title: memo.Title, + Content: memo.Content, + Tags: memo.Tags, + Visibility: apiv2pb.Visibility(memo.Visibility), + }, nil +} diff --git a/api/v2/v2.go b/api/v2/v2.go index 839fdb39..a1c71e80 100644 --- a/api/v2/v2.go +++ b/api/v2/v2.go @@ -25,6 +25,7 @@ type APIV2Service struct { apiv2pb.UnimplementedUserSettingServiceServer apiv2pb.UnimplementedShortcutServiceServer apiv2pb.UnimplementedCollectionServiceServer + apiv2pb.UnimplementedMemoServiceServer Secret string Profile *profile.Profile @@ -58,6 +59,7 @@ func NewAPIV2Service(secret string, profile *profile.Profile, store *store.Store apiv2pb.RegisterUserSettingServiceServer(grpcServer, apiV2Service) apiv2pb.RegisterShortcutServiceServer(grpcServer, apiV2Service) apiv2pb.RegisterCollectionServiceServer(grpcServer, apiV2Service) + apiv2pb.RegisterMemoServiceServer(grpcServer, apiV2Service) reflection.Register(grpcServer) return apiV2Service @@ -102,6 +104,9 @@ func (s *APIV2Service) RegisterGateway(ctx context.Context, e *echo.Echo) error if err := apiv2pb.RegisterCollectionServiceHandler(context.Background(), gwMux, conn); err != nil { return err } + if err := apiv2pb.RegisterMemoServiceHandler(context.Background(), gwMux, conn); err != nil { + return err + } e.Any("/api/v2/*", echo.WrapHandler(gwMux)) // GRPC web proxy. diff --git a/proto/api/v2/memo_service.proto b/proto/api/v2/memo_service.proto new file mode 100644 index 00000000..f3985a69 --- /dev/null +++ b/proto/api/v2/memo_service.proto @@ -0,0 +1,103 @@ +syntax = "proto3"; + +package slash.api.v2; + +import "api/v2/common.proto"; +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; + +option go_package = "gen/api/v2"; + +service MemoService { + // ListMemos returns a list of memos. + rpc ListMemos(ListMemosRequest) returns (ListMemosResponse) { + option (google.api.http) = {get: "/api/v2/memos"}; + } + // GetMemo returns a memo by id. + rpc GetMemo(GetMemoRequest) returns (GetMemoResponse) { + option (google.api.http) = {get: "/api/v2/memos/{id}"}; + option (google.api.method_signature) = "id"; + } + // CreateMemo creates a memo. + rpc CreateMemo(CreateMemoRequest) returns (CreateMemoResponse) { + option (google.api.http) = { + post: "/api/v2/memos" + body: "memo" + }; + } + // UpdateMemo updates a memo. + rpc UpdateMemo(UpdateMemoRequest) returns (UpdateMemoResponse) { + option (google.api.http) = { + put: "/api/v2/memos/{memo.id}" + body: "memo" + }; + option (google.api.method_signature) = "memo,update_mask"; + } + // DeleteMemo deletes a memo by id. + rpc DeleteMemo(DeleteMemoRequest) returns (DeleteMemoResponse) { + option (google.api.http) = {delete: "/api/v2/memos/{id}"}; + option (google.api.method_signature) = "id"; + } +} + +message Memo { + int32 id = 1; + + int32 creator_id = 2; + + google.protobuf.Timestamp created_time = 3; + + google.protobuf.Timestamp updated_time = 4; + + RowStatus row_status = 5; + + string name = 6; + + string title = 7; + + string content = 8; + + repeated string tags = 9; + + Visibility visibility = 10; +} + +message ListMemosRequest {} + +message ListMemosResponse { + repeated Memo memos = 1; +} + +message GetMemoRequest { + int32 id = 1; +} + +message GetMemoResponse { + Memo memo = 1; +} + +message CreateMemoRequest { + Memo memo = 1; +} + +message CreateMemoResponse { + Memo memo = 1; +} + +message UpdateMemoRequest { + Memo memo = 1; + + google.protobuf.FieldMask update_mask = 2; +} + +message UpdateMemoResponse { + Memo memo = 1; +} + +message DeleteMemoRequest { + int32 id = 1; +} + +message DeleteMemoResponse {} diff --git a/proto/gen/api/v2/README.md b/proto/gen/api/v2/README.md index 7979178f..8e7b1704 100644 --- a/proto/gen/api/v2/README.md +++ b/proto/gen/api/v2/README.md @@ -60,6 +60,21 @@ - [CollectionService](#slash-api-v2-CollectionService) +- [api/v2/memo_service.proto](#api_v2_memo_service-proto) + - [CreateMemoRequest](#slash-api-v2-CreateMemoRequest) + - [CreateMemoResponse](#slash-api-v2-CreateMemoResponse) + - [DeleteMemoRequest](#slash-api-v2-DeleteMemoRequest) + - [DeleteMemoResponse](#slash-api-v2-DeleteMemoResponse) + - [GetMemoRequest](#slash-api-v2-GetMemoRequest) + - [GetMemoResponse](#slash-api-v2-GetMemoResponse) + - [ListMemosRequest](#slash-api-v2-ListMemosRequest) + - [ListMemosResponse](#slash-api-v2-ListMemosResponse) + - [Memo](#slash-api-v2-Memo) + - [UpdateMemoRequest](#slash-api-v2-UpdateMemoRequest) + - [UpdateMemoResponse](#slash-api-v2-UpdateMemoResponse) + + - [MemoService](#slash-api-v2-MemoService) + - [api/v2/shortcut_service.proto](#api_v2_shortcut_service-proto) - [CreateShortcutRequest](#slash-api-v2-CreateShortcutRequest) - [CreateShortcutResponse](#slash-api-v2-CreateShortcutResponse) @@ -839,6 +854,201 @@ + +
+ +## api/v2/memo_service.proto + + + + + +### CreateMemoRequest + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| memo | [Memo](#slash-api-v2-Memo) | | | + + + + + + + + +### CreateMemoResponse + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| memo | [Memo](#slash-api-v2-Memo) | | | + + + + + + + + +### DeleteMemoRequest + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| id | [int32](#int32) | | | + + + + + + + + +### DeleteMemoResponse + + + + + + + + + +### GetMemoRequest + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| id | [int32](#int32) | | | + + + + + + + + +### GetMemoResponse + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| memo | [Memo](#slash-api-v2-Memo) | | | + + + + + + + + +### ListMemosRequest + + + + + + + + + +### ListMemosResponse + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| memos | [Memo](#slash-api-v2-Memo) | repeated | | + + + + + + + + +### Memo + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| id | [int32](#int32) | | | +| creator_id | [int32](#int32) | | | +| created_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | | +| updated_time | [google.protobuf.Timestamp](#google-protobuf-Timestamp) | | | +| row_status | [RowStatus](#slash-api-v2-RowStatus) | | | +| name | [string](#string) | | | +| title | [string](#string) | | | +| content | [string](#string) | | | +| tags | [string](#string) | repeated | | +| visibility | [Visibility](#slash-api-v2-Visibility) | | | + + + + + + + + +### UpdateMemoRequest + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| memo | [Memo](#slash-api-v2-Memo) | | | +| update_mask | [google.protobuf.FieldMask](#google-protobuf-FieldMask) | | | + + + + + + + + +### UpdateMemoResponse + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| memo | [Memo](#slash-api-v2-Memo) | | | + + + + + + + + + + + + + + +### MemoService + + +| Method Name | Request Type | Response Type | Description | +| ----------- | ------------ | ------------- | ------------| +| ListMemos | [ListMemosRequest](#slash-api-v2-ListMemosRequest) | [ListMemosResponse](#slash-api-v2-ListMemosResponse) | ListMemos returns a list of memos. | +| GetMemo | [GetMemoRequest](#slash-api-v2-GetMemoRequest) | [GetMemoResponse](#slash-api-v2-GetMemoResponse) | GetMemo returns a memo by id. | +| CreateMemo | [CreateMemoRequest](#slash-api-v2-CreateMemoRequest) | [CreateMemoResponse](#slash-api-v2-CreateMemoResponse) | CreateMemo creates a memo. | +| UpdateMemo | [UpdateMemoRequest](#slash-api-v2-UpdateMemoRequest) | [UpdateMemoResponse](#slash-api-v2-UpdateMemoResponse) | UpdateMemo updates a memo. | +| DeleteMemo | [DeleteMemoRequest](#slash-api-v2-DeleteMemoRequest) | [DeleteMemoResponse](#slash-api-v2-DeleteMemoResponse) | DeleteMemo deletes a memo by id. | + + + + + diff --git a/proto/gen/api/v2/memo_service.pb.go b/proto/gen/api/v2/memo_service.pb.go new file mode 100644 index 00000000..9557f01d --- /dev/null +++ b/proto/gen/api/v2/memo_service.pb.go @@ -0,0 +1,945 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.31.0 +// protoc (unknown) +// source: api/v2/memo_service.proto + +package apiv2 + +import ( + _ "google.golang.org/genproto/googleapis/api/annotations" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + fieldmaskpb "google.golang.org/protobuf/types/known/fieldmaskpb" + timestamppb "google.golang.org/protobuf/types/known/timestamppb" + reflect "reflect" + sync "sync" +) + +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) +) + +type Memo struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + CreatorId int32 `protobuf:"varint,2,opt,name=creator_id,json=creatorId,proto3" json:"creator_id,omitempty"` + CreatedTime *timestamppb.Timestamp `protobuf:"bytes,3,opt,name=created_time,json=createdTime,proto3" json:"created_time,omitempty"` + UpdatedTime *timestamppb.Timestamp `protobuf:"bytes,4,opt,name=updated_time,json=updatedTime,proto3" json:"updated_time,omitempty"` + RowStatus RowStatus `protobuf:"varint,5,opt,name=row_status,json=rowStatus,proto3,enum=slash.api.v2.RowStatus" json:"row_status,omitempty"` + Name string `protobuf:"bytes,6,opt,name=name,proto3" json:"name,omitempty"` + Title string `protobuf:"bytes,7,opt,name=title,proto3" json:"title,omitempty"` + Content string `protobuf:"bytes,8,opt,name=content,proto3" json:"content,omitempty"` + Tags []string `protobuf:"bytes,9,rep,name=tags,proto3" json:"tags,omitempty"` + Visibility Visibility `protobuf:"varint,10,opt,name=visibility,proto3,enum=slash.api.v2.Visibility" json:"visibility,omitempty"` +} + +func (x *Memo) Reset() { + *x = Memo{} + if protoimpl.UnsafeEnabled { + mi := &file_api_v2_memo_service_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Memo) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Memo) ProtoMessage() {} + +func (x *Memo) ProtoReflect() protoreflect.Message { + mi := &file_api_v2_memo_service_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Memo.ProtoReflect.Descriptor instead. +func (*Memo) Descriptor() ([]byte, []int) { + return file_api_v2_memo_service_proto_rawDescGZIP(), []int{0} +} + +func (x *Memo) GetId() int32 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *Memo) GetCreatorId() int32 { + if x != nil { + return x.CreatorId + } + return 0 +} + +func (x *Memo) GetCreatedTime() *timestamppb.Timestamp { + if x != nil { + return x.CreatedTime + } + return nil +} + +func (x *Memo) GetUpdatedTime() *timestamppb.Timestamp { + if x != nil { + return x.UpdatedTime + } + return nil +} + +func (x *Memo) GetRowStatus() RowStatus { + if x != nil { + return x.RowStatus + } + return RowStatus_ROW_STATUS_UNSPECIFIED +} + +func (x *Memo) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Memo) GetTitle() string { + if x != nil { + return x.Title + } + return "" +} + +func (x *Memo) GetContent() string { + if x != nil { + return x.Content + } + return "" +} + +func (x *Memo) GetTags() []string { + if x != nil { + return x.Tags + } + return nil +} + +func (x *Memo) GetVisibility() Visibility { + if x != nil { + return x.Visibility + } + return Visibility_VISIBILITY_UNSPECIFIED +} + +type ListMemosRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *ListMemosRequest) Reset() { + *x = ListMemosRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_api_v2_memo_service_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListMemosRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListMemosRequest) ProtoMessage() {} + +func (x *ListMemosRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_v2_memo_service_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListMemosRequest.ProtoReflect.Descriptor instead. +func (*ListMemosRequest) Descriptor() ([]byte, []int) { + return file_api_v2_memo_service_proto_rawDescGZIP(), []int{1} +} + +type ListMemosResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Memos []*Memo `protobuf:"bytes,1,rep,name=memos,proto3" json:"memos,omitempty"` +} + +func (x *ListMemosResponse) Reset() { + *x = ListMemosResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_api_v2_memo_service_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListMemosResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListMemosResponse) ProtoMessage() {} + +func (x *ListMemosResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_v2_memo_service_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ListMemosResponse.ProtoReflect.Descriptor instead. +func (*ListMemosResponse) Descriptor() ([]byte, []int) { + return file_api_v2_memo_service_proto_rawDescGZIP(), []int{2} +} + +func (x *ListMemosResponse) GetMemos() []*Memo { + if x != nil { + return x.Memos + } + return nil +} + +type GetMemoRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *GetMemoRequest) Reset() { + *x = GetMemoRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_api_v2_memo_service_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetMemoRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetMemoRequest) ProtoMessage() {} + +func (x *GetMemoRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_v2_memo_service_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetMemoRequest.ProtoReflect.Descriptor instead. +func (*GetMemoRequest) Descriptor() ([]byte, []int) { + return file_api_v2_memo_service_proto_rawDescGZIP(), []int{3} +} + +func (x *GetMemoRequest) GetId() int32 { + if x != nil { + return x.Id + } + return 0 +} + +type GetMemoResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Memo *Memo `protobuf:"bytes,1,opt,name=memo,proto3" json:"memo,omitempty"` +} + +func (x *GetMemoResponse) Reset() { + *x = GetMemoResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_api_v2_memo_service_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *GetMemoResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*GetMemoResponse) ProtoMessage() {} + +func (x *GetMemoResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_v2_memo_service_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use GetMemoResponse.ProtoReflect.Descriptor instead. +func (*GetMemoResponse) Descriptor() ([]byte, []int) { + return file_api_v2_memo_service_proto_rawDescGZIP(), []int{4} +} + +func (x *GetMemoResponse) GetMemo() *Memo { + if x != nil { + return x.Memo + } + return nil +} + +type CreateMemoRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Memo *Memo `protobuf:"bytes,1,opt,name=memo,proto3" json:"memo,omitempty"` +} + +func (x *CreateMemoRequest) Reset() { + *x = CreateMemoRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_api_v2_memo_service_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateMemoRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateMemoRequest) ProtoMessage() {} + +func (x *CreateMemoRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_v2_memo_service_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateMemoRequest.ProtoReflect.Descriptor instead. +func (*CreateMemoRequest) Descriptor() ([]byte, []int) { + return file_api_v2_memo_service_proto_rawDescGZIP(), []int{5} +} + +func (x *CreateMemoRequest) GetMemo() *Memo { + if x != nil { + return x.Memo + } + return nil +} + +type CreateMemoResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Memo *Memo `protobuf:"bytes,1,opt,name=memo,proto3" json:"memo,omitempty"` +} + +func (x *CreateMemoResponse) Reset() { + *x = CreateMemoResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_api_v2_memo_service_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CreateMemoResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CreateMemoResponse) ProtoMessage() {} + +func (x *CreateMemoResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_v2_memo_service_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CreateMemoResponse.ProtoReflect.Descriptor instead. +func (*CreateMemoResponse) Descriptor() ([]byte, []int) { + return file_api_v2_memo_service_proto_rawDescGZIP(), []int{6} +} + +func (x *CreateMemoResponse) GetMemo() *Memo { + if x != nil { + return x.Memo + } + return nil +} + +type UpdateMemoRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Memo *Memo `protobuf:"bytes,1,opt,name=memo,proto3" json:"memo,omitempty"` + UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"` +} + +func (x *UpdateMemoRequest) Reset() { + *x = UpdateMemoRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_api_v2_memo_service_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateMemoRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateMemoRequest) ProtoMessage() {} + +func (x *UpdateMemoRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_v2_memo_service_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateMemoRequest.ProtoReflect.Descriptor instead. +func (*UpdateMemoRequest) Descriptor() ([]byte, []int) { + return file_api_v2_memo_service_proto_rawDescGZIP(), []int{7} +} + +func (x *UpdateMemoRequest) GetMemo() *Memo { + if x != nil { + return x.Memo + } + return nil +} + +func (x *UpdateMemoRequest) GetUpdateMask() *fieldmaskpb.FieldMask { + if x != nil { + return x.UpdateMask + } + return nil +} + +type UpdateMemoResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Memo *Memo `protobuf:"bytes,1,opt,name=memo,proto3" json:"memo,omitempty"` +} + +func (x *UpdateMemoResponse) Reset() { + *x = UpdateMemoResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_api_v2_memo_service_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateMemoResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateMemoResponse) ProtoMessage() {} + +func (x *UpdateMemoResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_v2_memo_service_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateMemoResponse.ProtoReflect.Descriptor instead. +func (*UpdateMemoResponse) Descriptor() ([]byte, []int) { + return file_api_v2_memo_service_proto_rawDescGZIP(), []int{8} +} + +func (x *UpdateMemoResponse) GetMemo() *Memo { + if x != nil { + return x.Memo + } + return nil +} + +type DeleteMemoRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` +} + +func (x *DeleteMemoRequest) Reset() { + *x = DeleteMemoRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_api_v2_memo_service_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteMemoRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteMemoRequest) ProtoMessage() {} + +func (x *DeleteMemoRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_v2_memo_service_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteMemoRequest.ProtoReflect.Descriptor instead. +func (*DeleteMemoRequest) Descriptor() ([]byte, []int) { + return file_api_v2_memo_service_proto_rawDescGZIP(), []int{9} +} + +func (x *DeleteMemoRequest) GetId() int32 { + if x != nil { + return x.Id + } + return 0 +} + +type DeleteMemoResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *DeleteMemoResponse) Reset() { + *x = DeleteMemoResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_api_v2_memo_service_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteMemoResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteMemoResponse) ProtoMessage() {} + +func (x *DeleteMemoResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_v2_memo_service_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use DeleteMemoResponse.ProtoReflect.Descriptor instead. +func (*DeleteMemoResponse) Descriptor() ([]byte, []int) { + return file_api_v2_memo_service_proto_rawDescGZIP(), []int{10} +} + +var File_api_v2_memo_service_proto protoreflect.FileDescriptor + +var file_api_v2_memo_service_proto_rawDesc = []byte{ + 0x0a, 0x19, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, 0x5f, 0x73, 0x65, + 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x73, 0x6c, 0x61, + 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x1a, 0x13, 0x61, 0x70, 0x69, 0x2f, 0x76, + 0x32, 0x2f, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1c, + 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x61, 0x6e, 0x6e, 0x6f, 0x74, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x17, 0x67, 0x6f, + 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6c, 0x69, 0x65, 0x6e, 0x74, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x20, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x5f, 0x6d, 0x61, 0x73, + 0x6b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x1a, 0x1f, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, + 0x6d, 0x70, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0xfd, 0x02, 0x0a, 0x04, 0x4d, 0x65, 0x6d, + 0x6f, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, + 0x64, 0x12, 0x1d, 0x0a, 0x0a, 0x63, 0x72, 0x65, 0x61, 0x74, 0x6f, 0x72, 0x5f, 0x69, 0x64, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x63, 0x72, 0x65, 0x61, 0x74, 0x6f, 0x72, 0x49, 0x64, + 0x12, 0x3d, 0x0a, 0x0c, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, + 0x6d, 0x70, 0x52, 0x0b, 0x63, 0x72, 0x65, 0x61, 0x74, 0x65, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x12, + 0x3d, 0x0a, 0x0c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x69, 0x6d, 0x65, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x54, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, + 0x70, 0x52, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x64, 0x54, 0x69, 0x6d, 0x65, 0x12, 0x36, + 0x0a, 0x0a, 0x72, 0x6f, 0x77, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x05, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x17, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, + 0x32, 0x2e, 0x52, 0x6f, 0x77, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x09, 0x72, 0x6f, 0x77, + 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x06, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, + 0x74, 0x6c, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, + 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x08, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x61, + 0x67, 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, 0x09, 0x52, 0x04, 0x74, 0x61, 0x67, 0x73, 0x12, 0x38, + 0x0a, 0x0a, 0x76, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x18, 0x0a, 0x20, 0x01, + 0x28, 0x0e, 0x32, 0x18, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, + 0x32, 0x2e, 0x56, 0x69, 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x52, 0x0a, 0x76, 0x69, + 0x73, 0x69, 0x62, 0x69, 0x6c, 0x69, 0x74, 0x79, 0x22, 0x12, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, + 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x3d, 0x0a, 0x11, + 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x28, 0x0a, 0x05, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, + 0x32, 0x12, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, + 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x05, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x22, 0x20, 0x0a, 0x0e, 0x47, + 0x65, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x0e, 0x0a, + 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x22, 0x39, 0x0a, + 0x0f, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x26, 0x0a, 0x04, 0x6d, 0x65, 0x6d, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, + 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x65, + 0x6d, 0x6f, 0x52, 0x04, 0x6d, 0x65, 0x6d, 0x6f, 0x22, 0x3b, 0x0a, 0x11, 0x43, 0x72, 0x65, 0x61, + 0x74, 0x65, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x26, 0x0a, + 0x04, 0x6d, 0x65, 0x6d, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x73, 0x6c, + 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x65, 0x6d, 0x6f, 0x52, + 0x04, 0x6d, 0x65, 0x6d, 0x6f, 0x22, 0x3c, 0x0a, 0x12, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, + 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x26, 0x0a, 0x04, 0x6d, + 0x65, 0x6d, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x73, 0x6c, 0x61, 0x73, + 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x04, 0x6d, + 0x65, 0x6d, 0x6f, 0x22, 0x78, 0x0a, 0x11, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x6d, + 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x26, 0x0a, 0x04, 0x6d, 0x65, 0x6d, 0x6f, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, + 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x04, 0x6d, 0x65, 0x6d, 0x6f, + 0x12, 0x3b, 0x0a, 0x0b, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x1a, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x46, 0x69, 0x65, 0x6c, 0x64, 0x4d, 0x61, 0x73, + 0x6b, 0x52, 0x0a, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x61, 0x73, 0x6b, 0x22, 0x3c, 0x0a, + 0x12, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x12, 0x26, 0x0a, 0x04, 0x6d, 0x65, 0x6d, 0x6f, 0x18, 0x01, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x12, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, + 0x2e, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x04, 0x6d, 0x65, 0x6d, 0x6f, 0x22, 0x23, 0x0a, 0x11, 0x44, + 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, + 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, + 0x22, 0x14, 0x0a, 0x12, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xc7, 0x04, 0x0a, 0x0b, 0x4d, 0x65, 0x6d, 0x6f, 0x53, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x63, 0x0a, 0x09, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, + 0x6d, 0x6f, 0x73, 0x12, 0x1e, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, + 0x76, 0x32, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, + 0x76, 0x32, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x15, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x0f, 0x12, 0x0d, 0x2f, 0x61, + 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x12, 0x67, 0x0a, 0x07, 0x47, + 0x65, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x12, 0x1c, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, + 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1d, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, + 0x2e, 0x76, 0x32, 0x2e, 0x47, 0x65, 0x74, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, + 0x6e, 0x73, 0x65, 0x22, 0x1f, 0xda, 0x41, 0x02, 0x69, 0x64, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, + 0x12, 0x12, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, + 0x7b, 0x69, 0x64, 0x7d, 0x12, 0x6c, 0x0a, 0x0a, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x65, + 0x6d, 0x6f, 0x12, 0x1f, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, + 0x32, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, + 0x76, 0x32, 0x2e, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x73, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x1b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x15, 0x3a, 0x04, 0x6d, + 0x65, 0x6d, 0x6f, 0x22, 0x0d, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x6d, 0x65, 0x6d, + 0x6f, 0x73, 0x12, 0x89, 0x01, 0x0a, 0x0a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x6d, + 0x6f, 0x12, 0x1f, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, + 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, + 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, + 0x32, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x73, 0x70, + 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x38, 0xda, 0x41, 0x10, 0x6d, 0x65, 0x6d, 0x6f, 0x2c, 0x75, 0x70, + 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x1f, 0x3a, + 0x04, 0x6d, 0x65, 0x6d, 0x6f, 0x1a, 0x17, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x6d, + 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x7b, 0x6d, 0x65, 0x6d, 0x6f, 0x2e, 0x69, 0x64, 0x7d, 0x12, 0x70, + 0x0a, 0x0a, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x4d, 0x65, 0x6d, 0x6f, 0x12, 0x1f, 0x2e, 0x73, + 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x44, 0x65, 0x6c, 0x65, + 0x74, 0x65, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, + 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x44, 0x65, 0x6c, + 0x65, 0x74, 0x65, 0x4d, 0x65, 0x6d, 0x6f, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x1f, 0xda, 0x41, 0x02, 0x69, 0x64, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x2a, 0x12, 0x2f, 0x61, + 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x7b, 0x69, 0x64, 0x7d, + 0x42, 0xae, 0x01, 0x0a, 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2e, 0x61, + 0x70, 0x69, 0x2e, 0x76, 0x32, 0x42, 0x10, 0x4d, 0x65, 0x6d, 0x6f, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x63, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x36, 0x67, 0x69, 0x74, 0x68, 0x75, + 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x79, 0x6f, 0x75, 0x72, 0x73, 0x65, 0x6c, 0x66, 0x68, 0x6f, + 0x73, 0x74, 0x65, 0x64, 0x2f, 0x73, 0x6c, 0x61, 0x73, 0x68, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, + 0x2f, 0x67, 0x65, 0x6e, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x3b, 0x61, 0x70, 0x69, 0x76, + 0x32, 0xa2, 0x02, 0x03, 0x53, 0x41, 0x58, 0xaa, 0x02, 0x0c, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x2e, + 0x41, 0x70, 0x69, 0x2e, 0x56, 0x32, 0xca, 0x02, 0x0c, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x5c, 0x41, + 0x70, 0x69, 0x5c, 0x56, 0x32, 0xe2, 0x02, 0x18, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x5c, 0x41, 0x70, + 0x69, 0x5c, 0x56, 0x32, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, + 0xea, 0x02, 0x0e, 0x53, 0x6c, 0x61, 0x73, 0x68, 0x3a, 0x3a, 0x41, 0x70, 0x69, 0x3a, 0x3a, 0x56, + 0x32, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_api_v2_memo_service_proto_rawDescOnce sync.Once + file_api_v2_memo_service_proto_rawDescData = file_api_v2_memo_service_proto_rawDesc +) + +func file_api_v2_memo_service_proto_rawDescGZIP() []byte { + file_api_v2_memo_service_proto_rawDescOnce.Do(func() { + file_api_v2_memo_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_api_v2_memo_service_proto_rawDescData) + }) + return file_api_v2_memo_service_proto_rawDescData +} + +var file_api_v2_memo_service_proto_msgTypes = make([]protoimpl.MessageInfo, 11) +var file_api_v2_memo_service_proto_goTypes = []interface{}{ + (*Memo)(nil), // 0: slash.api.v2.Memo + (*ListMemosRequest)(nil), // 1: slash.api.v2.ListMemosRequest + (*ListMemosResponse)(nil), // 2: slash.api.v2.ListMemosResponse + (*GetMemoRequest)(nil), // 3: slash.api.v2.GetMemoRequest + (*GetMemoResponse)(nil), // 4: slash.api.v2.GetMemoResponse + (*CreateMemoRequest)(nil), // 5: slash.api.v2.CreateMemoRequest + (*CreateMemoResponse)(nil), // 6: slash.api.v2.CreateMemoResponse + (*UpdateMemoRequest)(nil), // 7: slash.api.v2.UpdateMemoRequest + (*UpdateMemoResponse)(nil), // 8: slash.api.v2.UpdateMemoResponse + (*DeleteMemoRequest)(nil), // 9: slash.api.v2.DeleteMemoRequest + (*DeleteMemoResponse)(nil), // 10: slash.api.v2.DeleteMemoResponse + (*timestamppb.Timestamp)(nil), // 11: google.protobuf.Timestamp + (RowStatus)(0), // 12: slash.api.v2.RowStatus + (Visibility)(0), // 13: slash.api.v2.Visibility + (*fieldmaskpb.FieldMask)(nil), // 14: google.protobuf.FieldMask +} +var file_api_v2_memo_service_proto_depIdxs = []int32{ + 11, // 0: slash.api.v2.Memo.created_time:type_name -> google.protobuf.Timestamp + 11, // 1: slash.api.v2.Memo.updated_time:type_name -> google.protobuf.Timestamp + 12, // 2: slash.api.v2.Memo.row_status:type_name -> slash.api.v2.RowStatus + 13, // 3: slash.api.v2.Memo.visibility:type_name -> slash.api.v2.Visibility + 0, // 4: slash.api.v2.ListMemosResponse.memos:type_name -> slash.api.v2.Memo + 0, // 5: slash.api.v2.GetMemoResponse.memo:type_name -> slash.api.v2.Memo + 0, // 6: slash.api.v2.CreateMemoRequest.memo:type_name -> slash.api.v2.Memo + 0, // 7: slash.api.v2.CreateMemoResponse.memo:type_name -> slash.api.v2.Memo + 0, // 8: slash.api.v2.UpdateMemoRequest.memo:type_name -> slash.api.v2.Memo + 14, // 9: slash.api.v2.UpdateMemoRequest.update_mask:type_name -> google.protobuf.FieldMask + 0, // 10: slash.api.v2.UpdateMemoResponse.memo:type_name -> slash.api.v2.Memo + 1, // 11: slash.api.v2.MemoService.ListMemos:input_type -> slash.api.v2.ListMemosRequest + 3, // 12: slash.api.v2.MemoService.GetMemo:input_type -> slash.api.v2.GetMemoRequest + 5, // 13: slash.api.v2.MemoService.CreateMemo:input_type -> slash.api.v2.CreateMemoRequest + 7, // 14: slash.api.v2.MemoService.UpdateMemo:input_type -> slash.api.v2.UpdateMemoRequest + 9, // 15: slash.api.v2.MemoService.DeleteMemo:input_type -> slash.api.v2.DeleteMemoRequest + 2, // 16: slash.api.v2.MemoService.ListMemos:output_type -> slash.api.v2.ListMemosResponse + 4, // 17: slash.api.v2.MemoService.GetMemo:output_type -> slash.api.v2.GetMemoResponse + 6, // 18: slash.api.v2.MemoService.CreateMemo:output_type -> slash.api.v2.CreateMemoResponse + 8, // 19: slash.api.v2.MemoService.UpdateMemo:output_type -> slash.api.v2.UpdateMemoResponse + 10, // 20: slash.api.v2.MemoService.DeleteMemo:output_type -> slash.api.v2.DeleteMemoResponse + 16, // [16:21] is the sub-list for method output_type + 11, // [11:16] is the sub-list for method input_type + 11, // [11:11] is the sub-list for extension type_name + 11, // [11:11] is the sub-list for extension extendee + 0, // [0:11] is the sub-list for field type_name +} + +func init() { file_api_v2_memo_service_proto_init() } +func file_api_v2_memo_service_proto_init() { + if File_api_v2_memo_service_proto != nil { + return + } + file_api_v2_common_proto_init() + if !protoimpl.UnsafeEnabled { + file_api_v2_memo_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Memo); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_v2_memo_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListMemosRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_v2_memo_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListMemosResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_v2_memo_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetMemoRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_v2_memo_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*GetMemoResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_v2_memo_service_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateMemoRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_v2_memo_service_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CreateMemoResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_v2_memo_service_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateMemoRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_v2_memo_service_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateMemoResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_v2_memo_service_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteMemoRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_v2_memo_service_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteMemoResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_api_v2_memo_service_proto_rawDesc, + NumEnums: 0, + NumMessages: 11, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_api_v2_memo_service_proto_goTypes, + DependencyIndexes: file_api_v2_memo_service_proto_depIdxs, + MessageInfos: file_api_v2_memo_service_proto_msgTypes, + }.Build() + File_api_v2_memo_service_proto = out.File + file_api_v2_memo_service_proto_rawDesc = nil + file_api_v2_memo_service_proto_goTypes = nil + file_api_v2_memo_service_proto_depIdxs = nil +} diff --git a/proto/gen/api/v2/memo_service.pb.gw.go b/proto/gen/api/v2/memo_service.pb.gw.go new file mode 100644 index 00000000..4055c245 --- /dev/null +++ b/proto/gen/api/v2/memo_service.pb.gw.go @@ -0,0 +1,583 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: api/v2/memo_service.proto + +/* +Package apiv2 is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package apiv2 + +import ( + "context" + "io" + "net/http" + + "github.com/grpc-ecosystem/grpc-gateway/v2/runtime" + "github.com/grpc-ecosystem/grpc-gateway/v2/utilities" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" + "google.golang.org/protobuf/proto" +) + +// Suppress "imported and not used" errors +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray +var _ = metadata.Join + +func request_MemoService_ListMemos_0(ctx context.Context, marshaler runtime.Marshaler, client MemoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ListMemosRequest + var metadata runtime.ServerMetadata + + msg, err := client.ListMemos(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_MemoService_ListMemos_0(ctx context.Context, marshaler runtime.Marshaler, server MemoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ListMemosRequest + var metadata runtime.ServerMetadata + + msg, err := server.ListMemos(ctx, &protoReq) + return msg, metadata, err + +} + +func request_MemoService_GetMemo_0(ctx context.Context, marshaler runtime.Marshaler, client MemoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetMemoRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") + } + + protoReq.Id, err = runtime.Int32(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) + } + + msg, err := client.GetMemo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_MemoService_GetMemo_0(ctx context.Context, marshaler runtime.Marshaler, server MemoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq GetMemoRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") + } + + protoReq.Id, err = runtime.Int32(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) + } + + msg, err := server.GetMemo(ctx, &protoReq) + return msg, metadata, err + +} + +func request_MemoService_CreateMemo_0(ctx context.Context, marshaler runtime.Marshaler, client MemoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq CreateMemoRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Memo); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.CreateMemo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_MemoService_CreateMemo_0(ctx context.Context, marshaler runtime.Marshaler, server MemoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq CreateMemoRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Memo); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.CreateMemo(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_MemoService_UpdateMemo_0 = &utilities.DoubleArray{Encoding: map[string]int{"memo": 0, "id": 1}, Base: []int{1, 4, 5, 2, 0, 0, 0, 0}, Check: []int{0, 1, 1, 2, 4, 2, 2, 3}} +) + +func request_MemoService_UpdateMemo_0(ctx context.Context, marshaler runtime.Marshaler, client MemoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq UpdateMemoRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Memo); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["memo.id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "memo.id") + } + + err = runtime.PopulateFieldFromPath(&protoReq, "memo.id", val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "memo.id", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_MemoService_UpdateMemo_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.UpdateMemo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_MemoService_UpdateMemo_0(ctx context.Context, marshaler runtime.Marshaler, server MemoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq UpdateMemoRequest + var metadata runtime.ServerMetadata + + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", berr) + } + if err := marshaler.NewDecoder(newReader()).Decode(&protoReq.Memo); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["memo.id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "memo.id") + } + + err = runtime.PopulateFieldFromPath(&protoReq, "memo.id", val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "memo.id", err) + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_MemoService_UpdateMemo_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.UpdateMemo(ctx, &protoReq) + return msg, metadata, err + +} + +func request_MemoService_DeleteMemo_0(ctx context.Context, marshaler runtime.Marshaler, client MemoServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq DeleteMemoRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") + } + + protoReq.Id, err = runtime.Int32(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) + } + + msg, err := client.DeleteMemo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_MemoService_DeleteMemo_0(ctx context.Context, marshaler runtime.Marshaler, server MemoServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq DeleteMemoRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["id"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "id") + } + + protoReq.Id, err = runtime.Int32(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "id", err) + } + + msg, err := server.DeleteMemo(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterMemoServiceHandlerServer registers the http handlers for service MemoService to "mux". +// UnaryRPC :call MemoServiceServer directly. +// StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. +// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterMemoServiceHandlerFromEndpoint instead. +func RegisterMemoServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server MemoServiceServer) error { + + mux.Handle("GET", pattern_MemoService_ListMemos_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/slash.api.v2.MemoService/ListMemos", runtime.WithHTTPPathPattern("/api/v2/memos")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_MemoService_ListMemos_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_MemoService_ListMemos_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_MemoService_GetMemo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/slash.api.v2.MemoService/GetMemo", runtime.WithHTTPPathPattern("/api/v2/memos/{id}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_MemoService_GetMemo_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_MemoService_GetMemo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_MemoService_CreateMemo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/slash.api.v2.MemoService/CreateMemo", runtime.WithHTTPPathPattern("/api/v2/memos")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_MemoService_CreateMemo_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_MemoService_CreateMemo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("PUT", pattern_MemoService_UpdateMemo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/slash.api.v2.MemoService/UpdateMemo", runtime.WithHTTPPathPattern("/api/v2/memos/{memo.id}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_MemoService_UpdateMemo_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_MemoService_UpdateMemo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("DELETE", pattern_MemoService_DeleteMemo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateIncomingContext(ctx, mux, req, "/slash.api.v2.MemoService/DeleteMemo", runtime.WithHTTPPathPattern("/api/v2/memos/{id}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_MemoService_DeleteMemo_0(annotatedContext, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_MemoService_DeleteMemo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterMemoServiceHandlerFromEndpoint is same as RegisterMemoServiceHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterMemoServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.DialContext(ctx, endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterMemoServiceHandler(ctx, mux, conn) +} + +// RegisterMemoServiceHandler registers the http handlers for service MemoService to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterMemoServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterMemoServiceHandlerClient(ctx, mux, NewMemoServiceClient(conn)) +} + +// RegisterMemoServiceHandlerClient registers the http handlers for service MemoService +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "MemoServiceClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "MemoServiceClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "MemoServiceClient" to call the correct interceptors. +func RegisterMemoServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client MemoServiceClient) error { + + mux.Handle("GET", pattern_MemoService_ListMemos_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/slash.api.v2.MemoService/ListMemos", runtime.WithHTTPPathPattern("/api/v2/memos")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_MemoService_ListMemos_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_MemoService_ListMemos_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("GET", pattern_MemoService_GetMemo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/slash.api.v2.MemoService/GetMemo", runtime.WithHTTPPathPattern("/api/v2/memos/{id}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_MemoService_GetMemo_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_MemoService_GetMemo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("POST", pattern_MemoService_CreateMemo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/slash.api.v2.MemoService/CreateMemo", runtime.WithHTTPPathPattern("/api/v2/memos")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_MemoService_CreateMemo_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_MemoService_CreateMemo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("PUT", pattern_MemoService_UpdateMemo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/slash.api.v2.MemoService/UpdateMemo", runtime.WithHTTPPathPattern("/api/v2/memos/{memo.id}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_MemoService_UpdateMemo_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_MemoService_UpdateMemo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("DELETE", pattern_MemoService_DeleteMemo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + var err error + var annotatedContext context.Context + annotatedContext, err = runtime.AnnotateContext(ctx, mux, req, "/slash.api.v2.MemoService/DeleteMemo", runtime.WithHTTPPathPattern("/api/v2/memos/{id}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_MemoService_DeleteMemo_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_MemoService_DeleteMemo_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_MemoService_ListMemos_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v2", "memos"}, "")) + + pattern_MemoService_GetMemo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"api", "v2", "memos", "id"}, "")) + + pattern_MemoService_CreateMemo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v2", "memos"}, "")) + + pattern_MemoService_UpdateMemo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"api", "v2", "memos", "memo.id"}, "")) + + pattern_MemoService_DeleteMemo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"api", "v2", "memos", "id"}, "")) +) + +var ( + forward_MemoService_ListMemos_0 = runtime.ForwardResponseMessage + + forward_MemoService_GetMemo_0 = runtime.ForwardResponseMessage + + forward_MemoService_CreateMemo_0 = runtime.ForwardResponseMessage + + forward_MemoService_UpdateMemo_0 = runtime.ForwardResponseMessage + + forward_MemoService_DeleteMemo_0 = runtime.ForwardResponseMessage +) diff --git a/proto/gen/api/v2/memo_service_grpc.pb.go b/proto/gen/api/v2/memo_service_grpc.pb.go new file mode 100644 index 00000000..8e636ff2 --- /dev/null +++ b/proto/gen/api/v2/memo_service_grpc.pb.go @@ -0,0 +1,267 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: api/v2/memo_service.proto + +package apiv2 + +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 ( + MemoService_ListMemos_FullMethodName = "/slash.api.v2.MemoService/ListMemos" + MemoService_GetMemo_FullMethodName = "/slash.api.v2.MemoService/GetMemo" + MemoService_CreateMemo_FullMethodName = "/slash.api.v2.MemoService/CreateMemo" + MemoService_UpdateMemo_FullMethodName = "/slash.api.v2.MemoService/UpdateMemo" + MemoService_DeleteMemo_FullMethodName = "/slash.api.v2.MemoService/DeleteMemo" +) + +// MemoServiceClient is the client API for MemoService 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 MemoServiceClient interface { + // ListMemos returns a list of memos. + ListMemos(ctx context.Context, in *ListMemosRequest, opts ...grpc.CallOption) (*ListMemosResponse, error) + // GetMemo returns a memo by id. + GetMemo(ctx context.Context, in *GetMemoRequest, opts ...grpc.CallOption) (*GetMemoResponse, error) + // CreateMemo creates a memo. + CreateMemo(ctx context.Context, in *CreateMemoRequest, opts ...grpc.CallOption) (*CreateMemoResponse, error) + // UpdateMemo updates a memo. + UpdateMemo(ctx context.Context, in *UpdateMemoRequest, opts ...grpc.CallOption) (*UpdateMemoResponse, error) + // DeleteMemo deletes a memo by id. + DeleteMemo(ctx context.Context, in *DeleteMemoRequest, opts ...grpc.CallOption) (*DeleteMemoResponse, error) +} + +type memoServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewMemoServiceClient(cc grpc.ClientConnInterface) MemoServiceClient { + return &memoServiceClient{cc} +} + +func (c *memoServiceClient) ListMemos(ctx context.Context, in *ListMemosRequest, opts ...grpc.CallOption) (*ListMemosResponse, error) { + out := new(ListMemosResponse) + err := c.cc.Invoke(ctx, MemoService_ListMemos_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *memoServiceClient) GetMemo(ctx context.Context, in *GetMemoRequest, opts ...grpc.CallOption) (*GetMemoResponse, error) { + out := new(GetMemoResponse) + err := c.cc.Invoke(ctx, MemoService_GetMemo_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *memoServiceClient) CreateMemo(ctx context.Context, in *CreateMemoRequest, opts ...grpc.CallOption) (*CreateMemoResponse, error) { + out := new(CreateMemoResponse) + err := c.cc.Invoke(ctx, MemoService_CreateMemo_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *memoServiceClient) UpdateMemo(ctx context.Context, in *UpdateMemoRequest, opts ...grpc.CallOption) (*UpdateMemoResponse, error) { + out := new(UpdateMemoResponse) + err := c.cc.Invoke(ctx, MemoService_UpdateMemo_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *memoServiceClient) DeleteMemo(ctx context.Context, in *DeleteMemoRequest, opts ...grpc.CallOption) (*DeleteMemoResponse, error) { + out := new(DeleteMemoResponse) + err := c.cc.Invoke(ctx, MemoService_DeleteMemo_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MemoServiceServer is the server API for MemoService service. +// All implementations must embed UnimplementedMemoServiceServer +// for forward compatibility +type MemoServiceServer interface { + // ListMemos returns a list of memos. + ListMemos(context.Context, *ListMemosRequest) (*ListMemosResponse, error) + // GetMemo returns a memo by id. + GetMemo(context.Context, *GetMemoRequest) (*GetMemoResponse, error) + // CreateMemo creates a memo. + CreateMemo(context.Context, *CreateMemoRequest) (*CreateMemoResponse, error) + // UpdateMemo updates a memo. + UpdateMemo(context.Context, *UpdateMemoRequest) (*UpdateMemoResponse, error) + // DeleteMemo deletes a memo by id. + DeleteMemo(context.Context, *DeleteMemoRequest) (*DeleteMemoResponse, error) + mustEmbedUnimplementedMemoServiceServer() +} + +// UnimplementedMemoServiceServer must be embedded to have forward compatible implementations. +type UnimplementedMemoServiceServer struct { +} + +func (UnimplementedMemoServiceServer) ListMemos(context.Context, *ListMemosRequest) (*ListMemosResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListMemos not implemented") +} +func (UnimplementedMemoServiceServer) GetMemo(context.Context, *GetMemoRequest) (*GetMemoResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method GetMemo not implemented") +} +func (UnimplementedMemoServiceServer) CreateMemo(context.Context, *CreateMemoRequest) (*CreateMemoResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateMemo not implemented") +} +func (UnimplementedMemoServiceServer) UpdateMemo(context.Context, *UpdateMemoRequest) (*UpdateMemoResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateMemo not implemented") +} +func (UnimplementedMemoServiceServer) DeleteMemo(context.Context, *DeleteMemoRequest) (*DeleteMemoResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteMemo not implemented") +} +func (UnimplementedMemoServiceServer) mustEmbedUnimplementedMemoServiceServer() {} + +// UnsafeMemoServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to MemoServiceServer will +// result in compilation errors. +type UnsafeMemoServiceServer interface { + mustEmbedUnimplementedMemoServiceServer() +} + +func RegisterMemoServiceServer(s grpc.ServiceRegistrar, srv MemoServiceServer) { + s.RegisterService(&MemoService_ServiceDesc, srv) +} + +func _MemoService_ListMemos_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListMemosRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MemoServiceServer).ListMemos(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: MemoService_ListMemos_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MemoServiceServer).ListMemos(ctx, req.(*ListMemosRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _MemoService_GetMemo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(GetMemoRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MemoServiceServer).GetMemo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: MemoService_GetMemo_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MemoServiceServer).GetMemo(ctx, req.(*GetMemoRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _MemoService_CreateMemo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(CreateMemoRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MemoServiceServer).CreateMemo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: MemoService_CreateMemo_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MemoServiceServer).CreateMemo(ctx, req.(*CreateMemoRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _MemoService_UpdateMemo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateMemoRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MemoServiceServer).UpdateMemo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: MemoService_UpdateMemo_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MemoServiceServer).UpdateMemo(ctx, req.(*UpdateMemoRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _MemoService_DeleteMemo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteMemoRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MemoServiceServer).DeleteMemo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: MemoService_DeleteMemo_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MemoServiceServer).DeleteMemo(ctx, req.(*DeleteMemoRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// MemoService_ServiceDesc is the grpc.ServiceDesc for MemoService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var MemoService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "slash.api.v2.MemoService", + HandlerType: (*MemoServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "ListMemos", + Handler: _MemoService_ListMemos_Handler, + }, + { + MethodName: "GetMemo", + Handler: _MemoService_GetMemo_Handler, + }, + { + MethodName: "CreateMemo", + Handler: _MemoService_CreateMemo_Handler, + }, + { + MethodName: "UpdateMemo", + Handler: _MemoService_UpdateMemo_Handler, + }, + { + MethodName: "DeleteMemo", + Handler: _MemoService_DeleteMemo_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "api/v2/memo_service.proto", +}