diff --git a/api/v2/inbox_service .go b/api/v2/inbox_service .go new file mode 100644 index 00000000..d2ae311f --- /dev/null +++ b/api/v2/inbox_service .go @@ -0,0 +1,125 @@ +package v2 + +import ( + "context" + "fmt" + + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + apiv2pb "github.com/usememos/memos/proto/gen/api/v2" + "github.com/usememos/memos/store" +) + +func (s *APIV2Service) ListInbox(ctx context.Context, _ *apiv2pb.ListInboxRequest) (*apiv2pb.ListInboxResponse, error) { + user, err := getCurrentUser(ctx, s.Store) + if err != nil { + return nil, status.Errorf(codes.Internal, "failed to get user") + } + + inboxList, err := s.Store.ListInbox(ctx, &store.FindInbox{ + ReceiverID: &user.ID, + }) + if err != nil { + return nil, status.Errorf(codes.Internal, "failed to list inbox: %v", err) + } + + response := &apiv2pb.ListInboxResponse{ + Inbox: []*apiv2pb.Inbox{}, + } + for _, inbox := range inboxList { + inboxMessage, err := s.convertInboxFromStore(ctx, inbox) + if err != nil { + return nil, status.Errorf(codes.Internal, "failed to convert inbox from store: %v", err) + } + response.Inbox = append(response.Inbox, inboxMessage) + } + + return response, nil +} + +func (s *APIV2Service) UpdateInbox(ctx context.Context, request *apiv2pb.UpdateInboxRequest) (*apiv2pb.UpdateInboxResponse, error) { + if request.UpdateMask == nil || len(request.UpdateMask.Paths) == 0 { + return nil, status.Errorf(codes.InvalidArgument, "update mask is required") + } + + inboxID, err := GetInboxID(request.Inbox.Name) + if err != nil { + return nil, status.Errorf(codes.InvalidArgument, "invalid inbox name: %v", err) + } + update := &store.UpdateInbox{ + ID: inboxID, + } + for _, path := range request.UpdateMask.Paths { + if path == "status" { + if request.Inbox.Status == apiv2pb.Inbox_STATUS_UNSPECIFIED { + return nil, status.Errorf(codes.InvalidArgument, "status is required") + } + update.Status = convertInboxStatusToStore(request.Inbox.Status) + } + } + + inbox, err := s.Store.UpdateInbox(ctx, update) + if err != nil { + return nil, status.Errorf(codes.Internal, "failed to update inbox: %v", err) + } + + inboxMessage, err := s.convertInboxFromStore(ctx, inbox) + if err != nil { + return nil, status.Errorf(codes.Internal, "failed to convert inbox from store: %v", err) + } + return &apiv2pb.UpdateInboxResponse{ + Inbox: inboxMessage, + }, nil +} + +func (s *APIV2Service) DeleteInbox(ctx context.Context, request *apiv2pb.DeleteInboxRequest) (*apiv2pb.DeleteInboxResponse, error) { + inboxID, err := GetInboxID(request.Name) + if err != nil { + return nil, status.Errorf(codes.InvalidArgument, "invalid inbox name: %v", err) + } + + if err := s.Store.DeleteInbox(ctx, &store.DeleteInbox{ + ID: inboxID, + }); err != nil { + return nil, status.Errorf(codes.Internal, "failed to update inbox: %v", err) + } + return &apiv2pb.DeleteInboxResponse{}, nil +} + +func (*APIV2Service) convertInboxFromStore(_ context.Context, inbox *store.Inbox) (*apiv2pb.Inbox, error) { + // TODO: convert sender and receiver. + return &apiv2pb.Inbox{ + Name: fmt.Sprintf("inbox/%d", inbox.ID), + Status: convertInboxStatusFromStore(inbox.Status), + Title: inbox.Message.Title, + Content: inbox.Message.Content, + Link: inbox.Message.Link, + }, nil +} + +func convertInboxStatusFromStore(status store.InboxStatus) apiv2pb.Inbox_Status { + switch status { + case store.UNREAD: + return apiv2pb.Inbox_UNREAD + case store.READ: + return apiv2pb.Inbox_READ + case store.ARCHIVED: + return apiv2pb.Inbox_ARCHIVED + default: + return apiv2pb.Inbox_STATUS_UNSPECIFIED + } +} + +func convertInboxStatusToStore(status apiv2pb.Inbox_Status) store.InboxStatus { + switch status { + case apiv2pb.Inbox_UNREAD: + return store.UNREAD + case apiv2pb.Inbox_READ: + return store.READ + case apiv2pb.Inbox_ARCHIVED: + return store.ARCHIVED + default: + return store.UNREAD + } +} diff --git a/api/v2/resource_name.go b/api/v2/resource_name.go new file mode 100644 index 00000000..da028864 --- /dev/null +++ b/api/v2/resource_name.go @@ -0,0 +1,46 @@ +package v2 + +import ( + "fmt" + "strconv" + "strings" + + "github.com/pkg/errors" +) + +const ( + InboxNamePrefix = "inbox/" +) + +// GetNameParentTokens returns the tokens from a resource name. +func GetNameParentTokens(name string, tokenPrefixes ...string) ([]string, error) { + parts := strings.Split(name, "/") + if len(parts) != 2*len(tokenPrefixes) { + return nil, errors.Errorf("invalid request %q", name) + } + + var tokens []string + for i, tokenPrefix := range tokenPrefixes { + if fmt.Sprintf("%s/", parts[2*i]) != tokenPrefix { + return nil, errors.Errorf("invalid prefix %q in request %q", tokenPrefix, name) + } + if parts[2*i+1] == "" { + return nil, errors.Errorf("invalid request %q with empty prefix %q", name, tokenPrefix) + } + tokens = append(tokens, parts[2*i+1]) + } + return tokens, nil +} + +// GetInboxID returns the inbox ID from a resource name. +func GetInboxID(name string) (int32, error) { + tokens, err := GetNameParentTokens(name, InboxNamePrefix) + if err != nil { + return 0, err + } + id, err := strconv.Atoi(tokens[0]) + if err != nil { + return 0, errors.Errorf("invalid inbox ID %q", tokens[0]) + } + return int32(id), nil +} diff --git a/api/v2/v2.go b/api/v2/v2.go index 05e2f577..109eb3f1 100644 --- a/api/v2/v2.go +++ b/api/v2/v2.go @@ -17,6 +17,8 @@ import ( ) type APIV2Service struct { + apiv2pb.UnimplementedInboxServiceServer + Secret string Profile *profile.Profile Store *store.Store @@ -33,20 +35,23 @@ func NewAPIV2Service(secret string, profile *profile.Profile, store *store.Store authProvider.AuthenticationInterceptor, ), ) - apiv2pb.RegisterSystemServiceServer(grpcServer, NewSystemService(profile, store)) - apiv2pb.RegisterUserServiceServer(grpcServer, NewUserService(store, secret)) - apiv2pb.RegisterMemoServiceServer(grpcServer, NewMemoService(store)) - apiv2pb.RegisterTagServiceServer(grpcServer, NewTagService(store)) - apiv2pb.RegisterResourceServiceServer(grpcServer, NewResourceService(profile, store)) - reflection.Register(grpcServer) - - return &APIV2Service{ + apiv2Service := &APIV2Service{ Secret: secret, Profile: profile, Store: store, grpcServer: grpcServer, grpcServerPort: grpcServerPort, } + + apiv2pb.RegisterSystemServiceServer(grpcServer, NewSystemService(profile, store)) + apiv2pb.RegisterUserServiceServer(grpcServer, NewUserService(store, secret)) + apiv2pb.RegisterMemoServiceServer(grpcServer, NewMemoService(store)) + apiv2pb.RegisterTagServiceServer(grpcServer, NewTagService(store)) + apiv2pb.RegisterResourceServiceServer(grpcServer, NewResourceService(profile, store)) + apiv2pb.RegisterInboxServiceServer(grpcServer, apiv2Service) + reflection.Register(grpcServer) + + return apiv2Service } func (s *APIV2Service) GetGRPCServer() *grpc.Server { @@ -82,6 +87,9 @@ func (s *APIV2Service) RegisterGateway(ctx context.Context, e *echo.Echo) error if err := apiv2pb.RegisterResourceServiceHandler(context.Background(), gwMux, conn); err != nil { return err } + if err := apiv2pb.RegisterInboxServiceHandler(context.Background(), gwMux, conn); err != nil { + return err + } e.Any("/api/v2/*", echo.WrapHandler(gwMux)) // GRPC web proxy. diff --git a/proto/api/v2/inbox_service.proto b/proto/api/v2/inbox_service.proto new file mode 100644 index 00000000..aaf9fdc8 --- /dev/null +++ b/proto/api/v2/inbox_service.proto @@ -0,0 +1,79 @@ +syntax = "proto3"; + +package memos.api.v2; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/protobuf/field_mask.proto"; + +option go_package = "gen/api/v2"; + +service InboxService { + rpc ListInbox(ListInboxRequest) returns (ListInboxResponse) { + option (google.api.http) = {get: "/api/v2/inbox"}; + } + + rpc UpdateInbox(UpdateInboxRequest) returns (UpdateInboxResponse) { + option (google.api.http) = { + patch: "/v2/inbox" + body: "inbox" + }; + option (google.api.method_signature) = "inbox,update_mask"; + } + + rpc DeleteInbox(DeleteInboxRequest) returns (DeleteInboxResponse) { + option (google.api.http) = {delete: "/v2/{name=inbox/*}"}; + option (google.api.method_signature) = "name"; + } +} + +message Inbox { + // The name of the inbox. + // Format: inbox/{id} + string name = 1; + // Format: users/{username} + string sender = 2; + // Format: users/{username} + string receiver = 3; + + enum Status { + STATUS_UNSPECIFIED = 0; + UNREAD = 1; + READ = 2; + ARCHIVED = 3; + } + Status status = 4; + + string title = 5; + + string content = 6; + + string link = 7; +} + +message ListInboxRequest { + // Format: /users/{username} + string user = 1; +} + +message ListInboxResponse { + repeated Inbox inbox = 1; +} + +message UpdateInboxRequest { + Inbox inbox = 1; + + google.protobuf.FieldMask update_mask = 2; +} + +message UpdateInboxResponse { + Inbox inbox = 1; +} + +message DeleteInboxRequest { + // The name of the inbox to delete. + // Format: inbox/{inbox} + string name = 1; +} + +message DeleteInboxResponse {} diff --git a/proto/gen/api/v2/README.md b/proto/gen/api/v2/README.md index 433e7e56..7de3b3de 100644 --- a/proto/gen/api/v2/README.md +++ b/proto/gen/api/v2/README.md @@ -6,6 +6,19 @@ - [api/v2/common.proto](#api_v2_common-proto) - [RowStatus](#memos-api-v2-RowStatus) +- [api/v2/inbox_service.proto](#api_v2_inbox_service-proto) + - [DeleteInboxRequest](#memos-api-v2-DeleteInboxRequest) + - [DeleteInboxResponse](#memos-api-v2-DeleteInboxResponse) + - [Inbox](#memos-api-v2-Inbox) + - [ListInboxRequest](#memos-api-v2-ListInboxRequest) + - [ListInboxResponse](#memos-api-v2-ListInboxResponse) + - [UpdateInboxRequest](#memos-api-v2-UpdateInboxRequest) + - [UpdateInboxResponse](#memos-api-v2-UpdateInboxResponse) + + - [Inbox.Status](#memos-api-v2-Inbox-Status) + + - [InboxService](#memos-api-v2-InboxService) + - [api/v2/memo_service.proto](#api_v2_memo_service-proto) - [CreateMemoCommentRequest](#memos-api-v2-CreateMemoCommentRequest) - [CreateMemoCommentResponse](#memos-api-v2-CreateMemoCommentResponse) @@ -109,6 +122,155 @@ + +
+ +## api/v2/inbox_service.proto + + + + + +### DeleteInboxRequest + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| name | [string](#string) | | The name of the inbox to delete. Format: inbox/{inbox} | + + + + + + + + +### DeleteInboxResponse + + + + + + + + + +### Inbox + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| name | [string](#string) | | The name of the inbox. Format: inbox/{id} | +| sender | [string](#string) | | Format: users/{username} | +| receiver | [string](#string) | | Format: users/{username} | +| status | [Inbox.Status](#memos-api-v2-Inbox-Status) | | | +| title | [string](#string) | | | +| content | [string](#string) | | | +| link | [string](#string) | | | + + + + + + + + +### ListInboxRequest + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| user | [string](#string) | | Format: /users/{username} | + + + + + + + + +### ListInboxResponse + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| inbox | [Inbox](#memos-api-v2-Inbox) | repeated | | + + + + + + + + +### UpdateInboxRequest + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| inbox | [Inbox](#memos-api-v2-Inbox) | | | +| update_mask | [google.protobuf.FieldMask](#google-protobuf-FieldMask) | | | + + + + + + + + +### UpdateInboxResponse + + + +| Field | Type | Label | Description | +| ----- | ---- | ----- | ----------- | +| inbox | [Inbox](#memos-api-v2-Inbox) | | | + + + + + + + + + + +### Inbox.Status + + +| Name | Number | Description | +| ---- | ------ | ----------- | +| STATUS_UNSPECIFIED | 0 | | +| UNREAD | 1 | | +| READ | 2 | | +| ARCHIVED | 3 | | + + + + + + + + + +### InboxService + + +| Method Name | Request Type | Response Type | Description | +| ----------- | ------------ | ------------- | ------------| +| ListInbox | [ListInboxRequest](#memos-api-v2-ListInboxRequest) | [ListInboxResponse](#memos-api-v2-ListInboxResponse) | | +| UpdateInbox | [UpdateInboxRequest](#memos-api-v2-UpdateInboxRequest) | [UpdateInboxResponse](#memos-api-v2-UpdateInboxResponse) | | +| DeleteInbox | [DeleteInboxRequest](#memos-api-v2-DeleteInboxRequest) | [DeleteInboxResponse](#memos-api-v2-DeleteInboxResponse) | | + + + + + diff --git a/proto/gen/api/v2/inbox_service.pb.go b/proto/gen/api/v2/inbox_service.pb.go new file mode 100644 index 00000000..d2b1e0cb --- /dev/null +++ b/proto/gen/api/v2/inbox_service.pb.go @@ -0,0 +1,701 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.31.0 +// protoc (unknown) +// source: api/v2/inbox_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" + 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 Inbox_Status int32 + +const ( + Inbox_STATUS_UNSPECIFIED Inbox_Status = 0 + Inbox_UNREAD Inbox_Status = 1 + Inbox_READ Inbox_Status = 2 + Inbox_ARCHIVED Inbox_Status = 3 +) + +// Enum value maps for Inbox_Status. +var ( + Inbox_Status_name = map[int32]string{ + 0: "STATUS_UNSPECIFIED", + 1: "UNREAD", + 2: "READ", + 3: "ARCHIVED", + } + Inbox_Status_value = map[string]int32{ + "STATUS_UNSPECIFIED": 0, + "UNREAD": 1, + "READ": 2, + "ARCHIVED": 3, + } +) + +func (x Inbox_Status) Enum() *Inbox_Status { + p := new(Inbox_Status) + *p = x + return p +} + +func (x Inbox_Status) String() string { + return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) +} + +func (Inbox_Status) Descriptor() protoreflect.EnumDescriptor { + return file_api_v2_inbox_service_proto_enumTypes[0].Descriptor() +} + +func (Inbox_Status) Type() protoreflect.EnumType { + return &file_api_v2_inbox_service_proto_enumTypes[0] +} + +func (x Inbox_Status) Number() protoreflect.EnumNumber { + return protoreflect.EnumNumber(x) +} + +// Deprecated: Use Inbox_Status.Descriptor instead. +func (Inbox_Status) EnumDescriptor() ([]byte, []int) { + return file_api_v2_inbox_service_proto_rawDescGZIP(), []int{0, 0} +} + +type Inbox struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The name of the inbox. + // Format: inbox/{id} + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Format: users/{username} + Sender string `protobuf:"bytes,2,opt,name=sender,proto3" json:"sender,omitempty"` + // Format: users/{username} + Receiver string `protobuf:"bytes,3,opt,name=receiver,proto3" json:"receiver,omitempty"` + Status Inbox_Status `protobuf:"varint,4,opt,name=status,proto3,enum=memos.api.v2.Inbox_Status" json:"status,omitempty"` + Title string `protobuf:"bytes,5,opt,name=title,proto3" json:"title,omitempty"` + Content string `protobuf:"bytes,6,opt,name=content,proto3" json:"content,omitempty"` + Link string `protobuf:"bytes,7,opt,name=link,proto3" json:"link,omitempty"` +} + +func (x *Inbox) Reset() { + *x = Inbox{} + if protoimpl.UnsafeEnabled { + mi := &file_api_v2_inbox_service_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Inbox) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Inbox) ProtoMessage() {} + +func (x *Inbox) ProtoReflect() protoreflect.Message { + mi := &file_api_v2_inbox_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 Inbox.ProtoReflect.Descriptor instead. +func (*Inbox) Descriptor() ([]byte, []int) { + return file_api_v2_inbox_service_proto_rawDescGZIP(), []int{0} +} + +func (x *Inbox) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Inbox) GetSender() string { + if x != nil { + return x.Sender + } + return "" +} + +func (x *Inbox) GetReceiver() string { + if x != nil { + return x.Receiver + } + return "" +} + +func (x *Inbox) GetStatus() Inbox_Status { + if x != nil { + return x.Status + } + return Inbox_STATUS_UNSPECIFIED +} + +func (x *Inbox) GetTitle() string { + if x != nil { + return x.Title + } + return "" +} + +func (x *Inbox) GetContent() string { + if x != nil { + return x.Content + } + return "" +} + +func (x *Inbox) GetLink() string { + if x != nil { + return x.Link + } + return "" +} + +type ListInboxRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Format: /users/{username} + User string `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` +} + +func (x *ListInboxRequest) Reset() { + *x = ListInboxRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_api_v2_inbox_service_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListInboxRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListInboxRequest) ProtoMessage() {} + +func (x *ListInboxRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_v2_inbox_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 ListInboxRequest.ProtoReflect.Descriptor instead. +func (*ListInboxRequest) Descriptor() ([]byte, []int) { + return file_api_v2_inbox_service_proto_rawDescGZIP(), []int{1} +} + +func (x *ListInboxRequest) GetUser() string { + if x != nil { + return x.User + } + return "" +} + +type ListInboxResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Inbox []*Inbox `protobuf:"bytes,1,rep,name=inbox,proto3" json:"inbox,omitempty"` +} + +func (x *ListInboxResponse) Reset() { + *x = ListInboxResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_api_v2_inbox_service_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ListInboxResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ListInboxResponse) ProtoMessage() {} + +func (x *ListInboxResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_v2_inbox_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 ListInboxResponse.ProtoReflect.Descriptor instead. +func (*ListInboxResponse) Descriptor() ([]byte, []int) { + return file_api_v2_inbox_service_proto_rawDescGZIP(), []int{2} +} + +func (x *ListInboxResponse) GetInbox() []*Inbox { + if x != nil { + return x.Inbox + } + return nil +} + +type UpdateInboxRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Inbox *Inbox `protobuf:"bytes,1,opt,name=inbox,proto3" json:"inbox,omitempty"` + UpdateMask *fieldmaskpb.FieldMask `protobuf:"bytes,2,opt,name=update_mask,json=updateMask,proto3" json:"update_mask,omitempty"` +} + +func (x *UpdateInboxRequest) Reset() { + *x = UpdateInboxRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_api_v2_inbox_service_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateInboxRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateInboxRequest) ProtoMessage() {} + +func (x *UpdateInboxRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_v2_inbox_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 UpdateInboxRequest.ProtoReflect.Descriptor instead. +func (*UpdateInboxRequest) Descriptor() ([]byte, []int) { + return file_api_v2_inbox_service_proto_rawDescGZIP(), []int{3} +} + +func (x *UpdateInboxRequest) GetInbox() *Inbox { + if x != nil { + return x.Inbox + } + return nil +} + +func (x *UpdateInboxRequest) GetUpdateMask() *fieldmaskpb.FieldMask { + if x != nil { + return x.UpdateMask + } + return nil +} + +type UpdateInboxResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Inbox *Inbox `protobuf:"bytes,1,opt,name=inbox,proto3" json:"inbox,omitempty"` +} + +func (x *UpdateInboxResponse) Reset() { + *x = UpdateInboxResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_api_v2_inbox_service_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *UpdateInboxResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateInboxResponse) ProtoMessage() {} + +func (x *UpdateInboxResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_v2_inbox_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 UpdateInboxResponse.ProtoReflect.Descriptor instead. +func (*UpdateInboxResponse) Descriptor() ([]byte, []int) { + return file_api_v2_inbox_service_proto_rawDescGZIP(), []int{4} +} + +func (x *UpdateInboxResponse) GetInbox() *Inbox { + if x != nil { + return x.Inbox + } + return nil +} + +type DeleteInboxRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The name of the inbox to delete. + // Format: inbox/{inbox} + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` +} + +func (x *DeleteInboxRequest) Reset() { + *x = DeleteInboxRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_api_v2_inbox_service_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteInboxRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteInboxRequest) ProtoMessage() {} + +func (x *DeleteInboxRequest) ProtoReflect() protoreflect.Message { + mi := &file_api_v2_inbox_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 DeleteInboxRequest.ProtoReflect.Descriptor instead. +func (*DeleteInboxRequest) Descriptor() ([]byte, []int) { + return file_api_v2_inbox_service_proto_rawDescGZIP(), []int{5} +} + +func (x *DeleteInboxRequest) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +type DeleteInboxResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields +} + +func (x *DeleteInboxResponse) Reset() { + *x = DeleteInboxResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_api_v2_inbox_service_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *DeleteInboxResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*DeleteInboxResponse) ProtoMessage() {} + +func (x *DeleteInboxResponse) ProtoReflect() protoreflect.Message { + mi := &file_api_v2_inbox_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 DeleteInboxResponse.ProtoReflect.Descriptor instead. +func (*DeleteInboxResponse) Descriptor() ([]byte, []int) { + return file_api_v2_inbox_service_proto_rawDescGZIP(), []int{6} +} + +var File_api_v2_inbox_service_proto protoreflect.FileDescriptor + +var file_api_v2_inbox_service_proto_rawDesc = []byte{ + 0x0a, 0x1a, 0x61, 0x70, 0x69, 0x2f, 0x76, 0x32, 0x2f, 0x69, 0x6e, 0x62, 0x6f, 0x78, 0x5f, 0x73, + 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x0c, 0x6d, 0x65, + 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 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, 0x22, 0x8d, 0x02, 0x0a, 0x05, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x12, 0x12, 0x0a, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, + 0x65, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x06, 0x73, 0x65, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x72, 0x65, 0x63, + 0x65, 0x69, 0x76, 0x65, 0x72, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x72, 0x65, 0x63, + 0x65, 0x69, 0x76, 0x65, 0x72, 0x12, 0x32, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, + 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x1a, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, + 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, + 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, + 0x6c, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, + 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6c, 0x69, 0x6e, + 0x6b, 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6c, 0x69, 0x6e, 0x6b, 0x22, 0x44, 0x0a, + 0x06, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x16, 0x0a, 0x12, 0x53, 0x54, 0x41, 0x54, 0x55, + 0x53, 0x5f, 0x55, 0x4e, 0x53, 0x50, 0x45, 0x43, 0x49, 0x46, 0x49, 0x45, 0x44, 0x10, 0x00, 0x12, + 0x0a, 0x0a, 0x06, 0x55, 0x4e, 0x52, 0x45, 0x41, 0x44, 0x10, 0x01, 0x12, 0x08, 0x0a, 0x04, 0x52, + 0x45, 0x41, 0x44, 0x10, 0x02, 0x12, 0x0c, 0x0a, 0x08, 0x41, 0x52, 0x43, 0x48, 0x49, 0x56, 0x45, + 0x44, 0x10, 0x03, 0x22, 0x26, 0x0a, 0x10, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x6e, 0x62, 0x6f, 0x78, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x22, 0x3e, 0x0a, 0x11, 0x4c, + 0x69, 0x73, 0x74, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x29, 0x0a, 0x05, 0x69, 0x6e, 0x62, 0x6f, 0x78, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, + 0x13, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x49, + 0x6e, 0x62, 0x6f, 0x78, 0x52, 0x05, 0x69, 0x6e, 0x62, 0x6f, 0x78, 0x22, 0x7c, 0x0a, 0x12, 0x55, + 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x29, 0x0a, 0x05, 0x69, 0x6e, 0x62, 0x6f, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x13, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, + 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x52, 0x05, 0x69, 0x6e, 0x62, 0x6f, 0x78, 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, 0x40, 0x0a, 0x13, 0x55, 0x70, 0x64, + 0x61, 0x74, 0x65, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x12, 0x29, 0x0a, 0x05, 0x69, 0x6e, 0x62, 0x6f, 0x78, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, + 0x13, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x49, + 0x6e, 0x62, 0x6f, 0x78, 0x52, 0x05, 0x69, 0x6e, 0x62, 0x6f, 0x78, 0x22, 0x28, 0x0a, 0x12, 0x44, + 0x65, 0x6c, 0x65, 0x74, 0x65, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x22, 0x15, 0x0a, 0x13, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x49, + 0x6e, 0x62, 0x6f, 0x78, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x32, 0xed, 0x02, 0x0a, + 0x0c, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x63, 0x0a, + 0x09, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x12, 0x1e, 0x2e, 0x6d, 0x65, 0x6d, + 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x6e, + 0x62, 0x6f, 0x78, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x6d, 0x65, 0x6d, + 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x4c, 0x69, 0x73, 0x74, 0x49, 0x6e, + 0x62, 0x6f, 0x78, 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, 0x69, 0x6e, 0x62, + 0x6f, 0x78, 0x12, 0x80, 0x01, 0x0a, 0x0b, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x62, + 0x6f, 0x78, 0x12, 0x20, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, + 0x32, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, + 0x2e, 0x76, 0x32, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x2c, 0xda, 0x41, 0x11, 0x69, 0x6e, 0x62, 0x6f, + 0x78, 0x2c, 0x75, 0x70, 0x64, 0x61, 0x74, 0x65, 0x5f, 0x6d, 0x61, 0x73, 0x6b, 0x82, 0xd3, 0xe4, + 0x93, 0x02, 0x12, 0x3a, 0x05, 0x69, 0x6e, 0x62, 0x6f, 0x78, 0x32, 0x09, 0x2f, 0x76, 0x32, 0x2f, + 0x69, 0x6e, 0x62, 0x6f, 0x78, 0x12, 0x75, 0x0a, 0x0b, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x49, + 0x6e, 0x62, 0x6f, 0x78, 0x12, 0x20, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, + 0x2e, 0x76, 0x32, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x21, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, + 0x70, 0x69, 0x2e, 0x76, 0x32, 0x2e, 0x44, 0x65, 0x6c, 0x65, 0x74, 0x65, 0x49, 0x6e, 0x62, 0x6f, + 0x78, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x21, 0xda, 0x41, 0x04, 0x6e, 0x61, + 0x6d, 0x65, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x14, 0x2a, 0x12, 0x2f, 0x76, 0x32, 0x2f, 0x7b, 0x6e, + 0x61, 0x6d, 0x65, 0x3d, 0x69, 0x6e, 0x62, 0x6f, 0x78, 0x2f, 0x2a, 0x7d, 0x42, 0xa9, 0x01, 0x0a, + 0x10, 0x63, 0x6f, 0x6d, 0x2e, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x76, + 0x32, 0x42, 0x11, 0x49, 0x6e, 0x62, 0x6f, 0x78, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x50, + 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x30, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, + 0x6f, 0x6d, 0x2f, 0x75, 0x73, 0x65, 0x6d, 0x65, 0x6d, 0x6f, 0x73, 0x2f, 0x6d, 0x65, 0x6d, 0x6f, + 0x73, 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, 0x4d, 0x41, 0x58, 0xaa, 0x02, + 0x0c, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x70, 0x69, 0x2e, 0x56, 0x32, 0xca, 0x02, 0x0c, + 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x32, 0xe2, 0x02, 0x18, 0x4d, + 0x65, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x69, 0x5c, 0x56, 0x32, 0x5c, 0x47, 0x50, 0x42, 0x4d, + 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x0e, 0x4d, 0x65, 0x6d, 0x6f, 0x73, 0x3a, + 0x3a, 0x41, 0x70, 0x69, 0x3a, 0x3a, 0x56, 0x32, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_api_v2_inbox_service_proto_rawDescOnce sync.Once + file_api_v2_inbox_service_proto_rawDescData = file_api_v2_inbox_service_proto_rawDesc +) + +func file_api_v2_inbox_service_proto_rawDescGZIP() []byte { + file_api_v2_inbox_service_proto_rawDescOnce.Do(func() { + file_api_v2_inbox_service_proto_rawDescData = protoimpl.X.CompressGZIP(file_api_v2_inbox_service_proto_rawDescData) + }) + return file_api_v2_inbox_service_proto_rawDescData +} + +var file_api_v2_inbox_service_proto_enumTypes = make([]protoimpl.EnumInfo, 1) +var file_api_v2_inbox_service_proto_msgTypes = make([]protoimpl.MessageInfo, 7) +var file_api_v2_inbox_service_proto_goTypes = []interface{}{ + (Inbox_Status)(0), // 0: memos.api.v2.Inbox.Status + (*Inbox)(nil), // 1: memos.api.v2.Inbox + (*ListInboxRequest)(nil), // 2: memos.api.v2.ListInboxRequest + (*ListInboxResponse)(nil), // 3: memos.api.v2.ListInboxResponse + (*UpdateInboxRequest)(nil), // 4: memos.api.v2.UpdateInboxRequest + (*UpdateInboxResponse)(nil), // 5: memos.api.v2.UpdateInboxResponse + (*DeleteInboxRequest)(nil), // 6: memos.api.v2.DeleteInboxRequest + (*DeleteInboxResponse)(nil), // 7: memos.api.v2.DeleteInboxResponse + (*fieldmaskpb.FieldMask)(nil), // 8: google.protobuf.FieldMask +} +var file_api_v2_inbox_service_proto_depIdxs = []int32{ + 0, // 0: memos.api.v2.Inbox.status:type_name -> memos.api.v2.Inbox.Status + 1, // 1: memos.api.v2.ListInboxResponse.inbox:type_name -> memos.api.v2.Inbox + 1, // 2: memos.api.v2.UpdateInboxRequest.inbox:type_name -> memos.api.v2.Inbox + 8, // 3: memos.api.v2.UpdateInboxRequest.update_mask:type_name -> google.protobuf.FieldMask + 1, // 4: memos.api.v2.UpdateInboxResponse.inbox:type_name -> memos.api.v2.Inbox + 2, // 5: memos.api.v2.InboxService.ListInbox:input_type -> memos.api.v2.ListInboxRequest + 4, // 6: memos.api.v2.InboxService.UpdateInbox:input_type -> memos.api.v2.UpdateInboxRequest + 6, // 7: memos.api.v2.InboxService.DeleteInbox:input_type -> memos.api.v2.DeleteInboxRequest + 3, // 8: memos.api.v2.InboxService.ListInbox:output_type -> memos.api.v2.ListInboxResponse + 5, // 9: memos.api.v2.InboxService.UpdateInbox:output_type -> memos.api.v2.UpdateInboxResponse + 7, // 10: memos.api.v2.InboxService.DeleteInbox:output_type -> memos.api.v2.DeleteInboxResponse + 8, // [8:11] is the sub-list for method output_type + 5, // [5:8] is the sub-list for method input_type + 5, // [5:5] is the sub-list for extension type_name + 5, // [5:5] is the sub-list for extension extendee + 0, // [0:5] is the sub-list for field type_name +} + +func init() { file_api_v2_inbox_service_proto_init() } +func file_api_v2_inbox_service_proto_init() { + if File_api_v2_inbox_service_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_api_v2_inbox_service_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Inbox); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_v2_inbox_service_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListInboxRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_v2_inbox_service_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ListInboxResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_v2_inbox_service_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateInboxRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_v2_inbox_service_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*UpdateInboxResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_v2_inbox_service_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteInboxRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_api_v2_inbox_service_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*DeleteInboxResponse); 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_inbox_service_proto_rawDesc, + NumEnums: 1, + NumMessages: 7, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_api_v2_inbox_service_proto_goTypes, + DependencyIndexes: file_api_v2_inbox_service_proto_depIdxs, + EnumInfos: file_api_v2_inbox_service_proto_enumTypes, + MessageInfos: file_api_v2_inbox_service_proto_msgTypes, + }.Build() + File_api_v2_inbox_service_proto = out.File + file_api_v2_inbox_service_proto_rawDesc = nil + file_api_v2_inbox_service_proto_goTypes = nil + file_api_v2_inbox_service_proto_depIdxs = nil +} diff --git a/proto/gen/api/v2/inbox_service.pb.gw.go b/proto/gen/api/v2/inbox_service.pb.gw.go new file mode 100644 index 00000000..2abf1513 --- /dev/null +++ b/proto/gen/api/v2/inbox_service.pb.gw.go @@ -0,0 +1,393 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: api/v2/inbox_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 + +var ( + filter_InboxService_ListInbox_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)} +) + +func request_InboxService_ListInbox_0(ctx context.Context, marshaler runtime.Marshaler, client InboxServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ListInboxRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_InboxService_ListInbox_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.ListInbox(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_InboxService_ListInbox_0(ctx context.Context, marshaler runtime.Marshaler, server InboxServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq ListInboxRequest + var metadata runtime.ServerMetadata + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_InboxService_ListInbox_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.ListInbox(ctx, &protoReq) + return msg, metadata, err + +} + +var ( + filter_InboxService_UpdateInbox_0 = &utilities.DoubleArray{Encoding: map[string]int{"inbox": 0}, Base: []int{1, 2, 0, 0}, Check: []int{0, 1, 2, 2}} +) + +func request_InboxService_UpdateInbox_0(ctx context.Context, marshaler runtime.Marshaler, client InboxServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq UpdateInboxRequest + 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.Inbox); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 { + if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), protoReq.Inbox); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } else { + protoReq.UpdateMask = fieldMask + } + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_InboxService_UpdateInbox_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := client.UpdateInbox(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_InboxService_UpdateInbox_0(ctx context.Context, marshaler runtime.Marshaler, server InboxServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq UpdateInboxRequest + 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.Inbox); err != nil && err != io.EOF { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if protoReq.UpdateMask == nil || len(protoReq.UpdateMask.GetPaths()) == 0 { + if fieldMask, err := runtime.FieldMaskFromRequestBody(newReader(), protoReq.Inbox); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } else { + protoReq.UpdateMask = fieldMask + } + } + + if err := req.ParseForm(); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_InboxService_UpdateInbox_0); err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) + } + + msg, err := server.UpdateInbox(ctx, &protoReq) + return msg, metadata, err + +} + +func request_InboxService_DeleteInbox_0(ctx context.Context, marshaler runtime.Marshaler, client InboxServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq DeleteInboxRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + + protoReq.Name, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + + msg, err := client.DeleteInbox(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_InboxService_DeleteInbox_0(ctx context.Context, marshaler runtime.Marshaler, server InboxServiceServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq DeleteInboxRequest + var metadata runtime.ServerMetadata + + var ( + val string + ok bool + err error + _ = err + ) + + val, ok = pathParams["name"] + if !ok { + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "name") + } + + protoReq.Name, err = runtime.String(val) + if err != nil { + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "name", err) + } + + msg, err := server.DeleteInbox(ctx, &protoReq) + return msg, metadata, err + +} + +// RegisterInboxServiceHandlerServer registers the http handlers for service InboxService to "mux". +// UnaryRPC :call InboxServiceServer 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 RegisterInboxServiceHandlerFromEndpoint instead. +func RegisterInboxServiceHandlerServer(ctx context.Context, mux *runtime.ServeMux, server InboxServiceServer) error { + + mux.Handle("GET", pattern_InboxService_ListInbox_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, "/memos.api.v2.InboxService/ListInbox", runtime.WithHTTPPathPattern("/api/v2/inbox")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_InboxService_ListInbox_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_InboxService_ListInbox_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("PATCH", pattern_InboxService_UpdateInbox_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, "/memos.api.v2.InboxService/UpdateInbox", runtime.WithHTTPPathPattern("/v2/inbox")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_InboxService_UpdateInbox_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_InboxService_UpdateInbox_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("DELETE", pattern_InboxService_DeleteInbox_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, "/memos.api.v2.InboxService/DeleteInbox", runtime.WithHTTPPathPattern("/v2/{name=inbox/*}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_InboxService_DeleteInbox_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_InboxService_DeleteInbox_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +// RegisterInboxServiceHandlerFromEndpoint is same as RegisterInboxServiceHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterInboxServiceHandlerFromEndpoint(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 RegisterInboxServiceHandler(ctx, mux, conn) +} + +// RegisterInboxServiceHandler registers the http handlers for service InboxService to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterInboxServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterInboxServiceHandlerClient(ctx, mux, NewInboxServiceClient(conn)) +} + +// RegisterInboxServiceHandlerClient registers the http handlers for service InboxService +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "InboxServiceClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "InboxServiceClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "InboxServiceClient" to call the correct interceptors. +func RegisterInboxServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client InboxServiceClient) error { + + mux.Handle("GET", pattern_InboxService_ListInbox_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, "/memos.api.v2.InboxService/ListInbox", runtime.WithHTTPPathPattern("/api/v2/inbox")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_InboxService_ListInbox_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_InboxService_ListInbox_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("PATCH", pattern_InboxService_UpdateInbox_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, "/memos.api.v2.InboxService/UpdateInbox", runtime.WithHTTPPathPattern("/v2/inbox")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_InboxService_UpdateInbox_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_InboxService_UpdateInbox_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + mux.Handle("DELETE", pattern_InboxService_DeleteInbox_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, "/memos.api.v2.InboxService/DeleteInbox", runtime.WithHTTPPathPattern("/v2/{name=inbox/*}")) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_InboxService_DeleteInbox_0(annotatedContext, inboundMarshaler, client, req, pathParams) + annotatedContext = runtime.NewServerMetadataContext(annotatedContext, md) + if err != nil { + runtime.HTTPError(annotatedContext, mux, outboundMarshaler, w, req, err) + return + } + + forward_InboxService_DeleteInbox_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_InboxService_ListInbox_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"api", "v2", "inbox"}, "")) + + pattern_InboxService_UpdateInbox_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v2", "inbox"}, "")) + + pattern_InboxService_DeleteInbox_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 2, 5, 2}, []string{"v2", "inbox", "name"}, "")) +) + +var ( + forward_InboxService_ListInbox_0 = runtime.ForwardResponseMessage + + forward_InboxService_UpdateInbox_0 = runtime.ForwardResponseMessage + + forward_InboxService_DeleteInbox_0 = runtime.ForwardResponseMessage +) diff --git a/proto/gen/api/v2/inbox_service_grpc.pb.go b/proto/gen/api/v2/inbox_service_grpc.pb.go new file mode 100644 index 00000000..5b2ba2a8 --- /dev/null +++ b/proto/gen/api/v2/inbox_service_grpc.pb.go @@ -0,0 +1,183 @@ +// Code generated by protoc-gen-go-grpc. DO NOT EDIT. +// versions: +// - protoc-gen-go-grpc v1.3.0 +// - protoc (unknown) +// source: api/v2/inbox_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 ( + InboxService_ListInbox_FullMethodName = "/memos.api.v2.InboxService/ListInbox" + InboxService_UpdateInbox_FullMethodName = "/memos.api.v2.InboxService/UpdateInbox" + InboxService_DeleteInbox_FullMethodName = "/memos.api.v2.InboxService/DeleteInbox" +) + +// InboxServiceClient is the client API for InboxService 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 InboxServiceClient interface { + ListInbox(ctx context.Context, in *ListInboxRequest, opts ...grpc.CallOption) (*ListInboxResponse, error) + UpdateInbox(ctx context.Context, in *UpdateInboxRequest, opts ...grpc.CallOption) (*UpdateInboxResponse, error) + DeleteInbox(ctx context.Context, in *DeleteInboxRequest, opts ...grpc.CallOption) (*DeleteInboxResponse, error) +} + +type inboxServiceClient struct { + cc grpc.ClientConnInterface +} + +func NewInboxServiceClient(cc grpc.ClientConnInterface) InboxServiceClient { + return &inboxServiceClient{cc} +} + +func (c *inboxServiceClient) ListInbox(ctx context.Context, in *ListInboxRequest, opts ...grpc.CallOption) (*ListInboxResponse, error) { + out := new(ListInboxResponse) + err := c.cc.Invoke(ctx, InboxService_ListInbox_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *inboxServiceClient) UpdateInbox(ctx context.Context, in *UpdateInboxRequest, opts ...grpc.CallOption) (*UpdateInboxResponse, error) { + out := new(UpdateInboxResponse) + err := c.cc.Invoke(ctx, InboxService_UpdateInbox_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *inboxServiceClient) DeleteInbox(ctx context.Context, in *DeleteInboxRequest, opts ...grpc.CallOption) (*DeleteInboxResponse, error) { + out := new(DeleteInboxResponse) + err := c.cc.Invoke(ctx, InboxService_DeleteInbox_FullMethodName, in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// InboxServiceServer is the server API for InboxService service. +// All implementations must embed UnimplementedInboxServiceServer +// for forward compatibility +type InboxServiceServer interface { + ListInbox(context.Context, *ListInboxRequest) (*ListInboxResponse, error) + UpdateInbox(context.Context, *UpdateInboxRequest) (*UpdateInboxResponse, error) + DeleteInbox(context.Context, *DeleteInboxRequest) (*DeleteInboxResponse, error) + mustEmbedUnimplementedInboxServiceServer() +} + +// UnimplementedInboxServiceServer must be embedded to have forward compatible implementations. +type UnimplementedInboxServiceServer struct { +} + +func (UnimplementedInboxServiceServer) ListInbox(context.Context, *ListInboxRequest) (*ListInboxResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ListInbox not implemented") +} +func (UnimplementedInboxServiceServer) UpdateInbox(context.Context, *UpdateInboxRequest) (*UpdateInboxResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateInbox not implemented") +} +func (UnimplementedInboxServiceServer) DeleteInbox(context.Context, *DeleteInboxRequest) (*DeleteInboxResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteInbox not implemented") +} +func (UnimplementedInboxServiceServer) mustEmbedUnimplementedInboxServiceServer() {} + +// UnsafeInboxServiceServer may be embedded to opt out of forward compatibility for this service. +// Use of this interface is not recommended, as added methods to InboxServiceServer will +// result in compilation errors. +type UnsafeInboxServiceServer interface { + mustEmbedUnimplementedInboxServiceServer() +} + +func RegisterInboxServiceServer(s grpc.ServiceRegistrar, srv InboxServiceServer) { + s.RegisterService(&InboxService_ServiceDesc, srv) +} + +func _InboxService_ListInbox_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(ListInboxRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(InboxServiceServer).ListInbox(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: InboxService_ListInbox_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(InboxServiceServer).ListInbox(ctx, req.(*ListInboxRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _InboxService_UpdateInbox_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateInboxRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(InboxServiceServer).UpdateInbox(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: InboxService_UpdateInbox_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(InboxServiceServer).UpdateInbox(ctx, req.(*UpdateInboxRequest)) + } + return interceptor(ctx, in, info, handler) +} + +func _InboxService_DeleteInbox_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(DeleteInboxRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(InboxServiceServer).DeleteInbox(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: InboxService_DeleteInbox_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(InboxServiceServer).DeleteInbox(ctx, req.(*DeleteInboxRequest)) + } + return interceptor(ctx, in, info, handler) +} + +// InboxService_ServiceDesc is the grpc.ServiceDesc for InboxService service. +// It's only intended for direct use with grpc.RegisterService, +// and not to be introspected or modified (even as a copy) +var InboxService_ServiceDesc = grpc.ServiceDesc{ + ServiceName: "memos.api.v2.InboxService", + HandlerType: (*InboxServiceServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "ListInbox", + Handler: _InboxService_ListInbox_Handler, + }, + { + MethodName: "UpdateInbox", + Handler: _InboxService_UpdateInbox_Handler, + }, + { + MethodName: "DeleteInbox", + Handler: _InboxService_DeleteInbox_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "api/v2/inbox_service.proto", +}