diff --git a/chat.pb.go b/chat.pb.go index 3f3d31d..dfd71ef 100644 --- a/chat.pb.go +++ b/chat.pb.go @@ -543,6 +543,58 @@ func (x *CreateTopicRequest) GetDisplayName() string { return "" } +type UpdateTopicRequest struct { + state protoimpl.MessageState `protogen:"open.v1"` + Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` // UUID + DisplayName string `protobuf:"bytes,2,opt,name=display_name,json=displayName,proto3" json:"display_name,omitempty"` // new display name (required, full replace) + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache +} + +func (x *UpdateTopicRequest) Reset() { + *x = UpdateTopicRequest{} + mi := &file_chat_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) +} + +func (x *UpdateTopicRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*UpdateTopicRequest) ProtoMessage() {} + +func (x *UpdateTopicRequest) ProtoReflect() protoreflect.Message { + mi := &file_chat_proto_msgTypes[6] + if x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use UpdateTopicRequest.ProtoReflect.Descriptor instead. +func (*UpdateTopicRequest) Descriptor() ([]byte, []int) { + return file_chat_proto_rawDescGZIP(), []int{6} +} + +func (x *UpdateTopicRequest) GetId() string { + if x != nil { + return x.Id + } + return "" +} + +func (x *UpdateTopicRequest) GetDisplayName() string { + if x != nil { + return x.DisplayName + } + return "" +} + type PostMessageRequest struct { state protoimpl.MessageState `protogen:"open.v1"` TopicId string `protobuf:"bytes,1,opt,name=topic_id,json=topicId,proto3" json:"topic_id,omitempty"` @@ -560,7 +612,7 @@ type PostMessageRequest struct { func (x *PostMessageRequest) Reset() { *x = PostMessageRequest{} - mi := &file_chat_proto_msgTypes[6] + mi := &file_chat_proto_msgTypes[7] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -572,7 +624,7 @@ func (x *PostMessageRequest) String() string { func (*PostMessageRequest) ProtoMessage() {} func (x *PostMessageRequest) ProtoReflect() protoreflect.Message { - mi := &file_chat_proto_msgTypes[6] + mi := &file_chat_proto_msgTypes[7] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -585,7 +637,7 @@ func (x *PostMessageRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use PostMessageRequest.ProtoReflect.Descriptor instead. func (*PostMessageRequest) Descriptor() ([]byte, []int) { - return file_chat_proto_rawDescGZIP(), []int{6} + return file_chat_proto_rawDescGZIP(), []int{7} } func (x *PostMessageRequest) GetTopicId() string { @@ -647,7 +699,7 @@ type PostMessageResponse struct { func (x *PostMessageResponse) Reset() { *x = PostMessageResponse{} - mi := &file_chat_proto_msgTypes[7] + mi := &file_chat_proto_msgTypes[8] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -659,7 +711,7 @@ func (x *PostMessageResponse) String() string { func (*PostMessageResponse) ProtoMessage() {} func (x *PostMessageResponse) ProtoReflect() protoreflect.Message { - mi := &file_chat_proto_msgTypes[7] + mi := &file_chat_proto_msgTypes[8] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -672,7 +724,7 @@ func (x *PostMessageResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use PostMessageResponse.ProtoReflect.Descriptor instead. func (*PostMessageResponse) Descriptor() ([]byte, []int) { - return file_chat_proto_rawDescGZIP(), []int{7} + return file_chat_proto_rawDescGZIP(), []int{8} } func (x *PostMessageResponse) GetMessage() *Message { @@ -698,7 +750,7 @@ type GetMessageRequest struct { func (x *GetMessageRequest) Reset() { *x = GetMessageRequest{} - mi := &file_chat_proto_msgTypes[8] + mi := &file_chat_proto_msgTypes[9] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -710,7 +762,7 @@ func (x *GetMessageRequest) String() string { func (*GetMessageRequest) ProtoMessage() {} func (x *GetMessageRequest) ProtoReflect() protoreflect.Message { - mi := &file_chat_proto_msgTypes[8] + mi := &file_chat_proto_msgTypes[9] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -723,7 +775,7 @@ func (x *GetMessageRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use GetMessageRequest.ProtoReflect.Descriptor instead. func (*GetMessageRequest) Descriptor() ([]byte, []int) { - return file_chat_proto_rawDescGZIP(), []int{8} + return file_chat_proto_rawDescGZIP(), []int{9} } func (x *GetMessageRequest) GetMessageId() string { @@ -750,7 +802,7 @@ type HistoryRequest struct { func (x *HistoryRequest) Reset() { *x = HistoryRequest{} - mi := &file_chat_proto_msgTypes[9] + mi := &file_chat_proto_msgTypes[10] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -762,7 +814,7 @@ func (x *HistoryRequest) String() string { func (*HistoryRequest) ProtoMessage() {} func (x *HistoryRequest) ProtoReflect() protoreflect.Message { - mi := &file_chat_proto_msgTypes[9] + mi := &file_chat_proto_msgTypes[10] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -775,7 +827,7 @@ func (x *HistoryRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use HistoryRequest.ProtoReflect.Descriptor instead. func (*HistoryRequest) Descriptor() ([]byte, []int) { - return file_chat_proto_rawDescGZIP(), []int{9} + return file_chat_proto_rawDescGZIP(), []int{10} } func (x *HistoryRequest) GetTopicId() string { @@ -817,7 +869,7 @@ type HistoryResponse struct { func (x *HistoryResponse) Reset() { *x = HistoryResponse{} - mi := &file_chat_proto_msgTypes[10] + mi := &file_chat_proto_msgTypes[11] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -829,7 +881,7 @@ func (x *HistoryResponse) String() string { func (*HistoryResponse) ProtoMessage() {} func (x *HistoryResponse) ProtoReflect() protoreflect.Message { - mi := &file_chat_proto_msgTypes[10] + mi := &file_chat_proto_msgTypes[11] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -842,7 +894,7 @@ func (x *HistoryResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use HistoryResponse.ProtoReflect.Descriptor instead. func (*HistoryResponse) Descriptor() ([]byte, []int) { - return file_chat_proto_rawDescGZIP(), []int{10} + return file_chat_proto_rawDescGZIP(), []int{11} } func (x *HistoryResponse) GetMessages() []*Message { @@ -869,7 +921,7 @@ type SubscribeRequest struct { func (x *SubscribeRequest) Reset() { *x = SubscribeRequest{} - mi := &file_chat_proto_msgTypes[11] + mi := &file_chat_proto_msgTypes[12] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -881,7 +933,7 @@ func (x *SubscribeRequest) String() string { func (*SubscribeRequest) ProtoMessage() {} func (x *SubscribeRequest) ProtoReflect() protoreflect.Message { - mi := &file_chat_proto_msgTypes[11] + mi := &file_chat_proto_msgTypes[12] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -894,7 +946,7 @@ func (x *SubscribeRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use SubscribeRequest.ProtoReflect.Descriptor instead. func (*SubscribeRequest) Descriptor() ([]byte, []int) { - return file_chat_proto_rawDescGZIP(), []int{11} + return file_chat_proto_rawDescGZIP(), []int{12} } func (x *SubscribeRequest) GetConsumerId() string { @@ -922,7 +974,7 @@ type AcknowledgeRequest struct { func (x *AcknowledgeRequest) Reset() { *x = AcknowledgeRequest{} - mi := &file_chat_proto_msgTypes[12] + mi := &file_chat_proto_msgTypes[13] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -934,7 +986,7 @@ func (x *AcknowledgeRequest) String() string { func (*AcknowledgeRequest) ProtoMessage() {} func (x *AcknowledgeRequest) ProtoReflect() protoreflect.Message { - mi := &file_chat_proto_msgTypes[12] + mi := &file_chat_proto_msgTypes[13] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -947,7 +999,7 @@ func (x *AcknowledgeRequest) ProtoReflect() protoreflect.Message { // Deprecated: Use AcknowledgeRequest.ProtoReflect.Descriptor instead. func (*AcknowledgeRequest) Descriptor() ([]byte, []int) { - return file_chat_proto_rawDescGZIP(), []int{12} + return file_chat_proto_rawDescGZIP(), []int{13} } func (x *AcknowledgeRequest) GetConsumerId() string { @@ -980,7 +1032,7 @@ type AcknowledgeResponse struct { func (x *AcknowledgeResponse) Reset() { *x = AcknowledgeResponse{} - mi := &file_chat_proto_msgTypes[13] + mi := &file_chat_proto_msgTypes[14] ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) ms.StoreMessageInfo(mi) } @@ -992,7 +1044,7 @@ func (x *AcknowledgeResponse) String() string { func (*AcknowledgeResponse) ProtoMessage() {} func (x *AcknowledgeResponse) ProtoReflect() protoreflect.Message { - mi := &file_chat_proto_msgTypes[13] + mi := &file_chat_proto_msgTypes[14] if x != nil { ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) if ms.LoadMessageInfo() == nil { @@ -1005,7 +1057,7 @@ func (x *AcknowledgeResponse) ProtoReflect() protoreflect.Message { // Deprecated: Use AcknowledgeResponse.ProtoReflect.Descriptor instead. func (*AcknowledgeResponse) Descriptor() ([]byte, []int) { - return file_chat_proto_rawDescGZIP(), []int{13} + return file_chat_proto_rawDescGZIP(), []int{14} } func (x *AcknowledgeResponse) GetLastAckSequence() int64 { @@ -1054,6 +1106,9 @@ const file_chat_proto_rawDesc = "" + "\bselector\"K\n" + "\x12CreateTopicRequest\x12\x12\n" + "\x04slug\x18\x01 \x01(\tR\x04slug\x12!\n" + + "\fdisplay_name\x18\x02 \x01(\tR\vdisplayName\"G\n" + + "\x12UpdateTopicRequest\x12\x0e\n" + + "\x02id\x18\x01 \x01(\tR\x02id\x12!\n" + "\fdisplay_name\x18\x02 \x01(\tR\vdisplayName\"\xbb\x02\n" + "\x12PostMessageRequest\x12\x19\n" + "\btopic_id\x18\x01 \x01(\tR\atopicId\x12\x1b\n" + @@ -1104,12 +1159,13 @@ const file_chat_proto_rawDesc = "" + "\x12MESSAGE_SOURCE_WEB\x10\x01\x12\x1b\n" + "\x17MESSAGE_SOURCE_TELEGRAM\x10\x02\x12\x18\n" + "\x14MESSAGE_SOURCE_AGENT\x10\x03\x12\x19\n" + - "\x15MESSAGE_SOURCE_SYSTEM\x10\x042\xe0\x03\n" + + "\x15MESSAGE_SOURCE_SYSTEM\x10\x042\x96\x04\n" + "\vChatService\x12?\n" + "\n" + "ListTopics\x12\x17.chat.ListTopicsRequest\x1a\x18.chat.ListTopicsResponse\x12.\n" + "\bGetTopic\x12\x15.chat.GetTopicRequest\x1a\v.chat.Topic\x124\n" + - "\vCreateTopic\x12\x18.chat.CreateTopicRequest\x1a\v.chat.Topic\x12B\n" + + "\vCreateTopic\x12\x18.chat.CreateTopicRequest\x1a\v.chat.Topic\x124\n" + + "\vUpdateTopic\x12\x18.chat.UpdateTopicRequest\x1a\v.chat.Topic\x12B\n" + "\vPostMessage\x12\x18.chat.PostMessageRequest\x1a\x19.chat.PostMessageResponse\x124\n" + "\n" + "GetMessage\x12\x17.chat.GetMessageRequest\x1a\r.chat.Message\x126\n" + @@ -1130,7 +1186,7 @@ func file_chat_proto_rawDescGZIP() []byte { } var file_chat_proto_enumTypes = make([]protoimpl.EnumInfo, 2) -var file_chat_proto_msgTypes = make([]protoimpl.MessageInfo, 14) +var file_chat_proto_msgTypes = make([]protoimpl.MessageInfo, 15) var file_chat_proto_goTypes = []any{ (AuthorType)(0), // 0: chat.AuthorType (MessageSource)(0), // 1: chat.MessageSource @@ -1140,21 +1196,22 @@ var file_chat_proto_goTypes = []any{ (*ListTopicsResponse)(nil), // 5: chat.ListTopicsResponse (*GetTopicRequest)(nil), // 6: chat.GetTopicRequest (*CreateTopicRequest)(nil), // 7: chat.CreateTopicRequest - (*PostMessageRequest)(nil), // 8: chat.PostMessageRequest - (*PostMessageResponse)(nil), // 9: chat.PostMessageResponse - (*GetMessageRequest)(nil), // 10: chat.GetMessageRequest - (*HistoryRequest)(nil), // 11: chat.HistoryRequest - (*HistoryResponse)(nil), // 12: chat.HistoryResponse - (*SubscribeRequest)(nil), // 13: chat.SubscribeRequest - (*AcknowledgeRequest)(nil), // 14: chat.AcknowledgeRequest - (*AcknowledgeResponse)(nil), // 15: chat.AcknowledgeResponse - (*timestamppb.Timestamp)(nil), // 16: google.protobuf.Timestamp + (*UpdateTopicRequest)(nil), // 8: chat.UpdateTopicRequest + (*PostMessageRequest)(nil), // 9: chat.PostMessageRequest + (*PostMessageResponse)(nil), // 10: chat.PostMessageResponse + (*GetMessageRequest)(nil), // 11: chat.GetMessageRequest + (*HistoryRequest)(nil), // 12: chat.HistoryRequest + (*HistoryResponse)(nil), // 13: chat.HistoryResponse + (*SubscribeRequest)(nil), // 14: chat.SubscribeRequest + (*AcknowledgeRequest)(nil), // 15: chat.AcknowledgeRequest + (*AcknowledgeResponse)(nil), // 16: chat.AcknowledgeResponse + (*timestamppb.Timestamp)(nil), // 17: google.protobuf.Timestamp } var file_chat_proto_depIdxs = []int32{ - 16, // 0: chat.Topic.created_at:type_name -> google.protobuf.Timestamp + 17, // 0: chat.Topic.created_at:type_name -> google.protobuf.Timestamp 0, // 1: chat.Message.author_type:type_name -> chat.AuthorType 1, // 2: chat.Message.source:type_name -> chat.MessageSource - 16, // 3: chat.Message.created_at:type_name -> google.protobuf.Timestamp + 17, // 3: chat.Message.created_at:type_name -> google.protobuf.Timestamp 2, // 4: chat.ListTopicsResponse.topics:type_name -> chat.Topic 0, // 5: chat.PostMessageRequest.author_type:type_name -> chat.AuthorType 1, // 6: chat.PostMessageRequest.source:type_name -> chat.MessageSource @@ -1163,21 +1220,23 @@ var file_chat_proto_depIdxs = []int32{ 4, // 9: chat.ChatService.ListTopics:input_type -> chat.ListTopicsRequest 6, // 10: chat.ChatService.GetTopic:input_type -> chat.GetTopicRequest 7, // 11: chat.ChatService.CreateTopic:input_type -> chat.CreateTopicRequest - 8, // 12: chat.ChatService.PostMessage:input_type -> chat.PostMessageRequest - 10, // 13: chat.ChatService.GetMessage:input_type -> chat.GetMessageRequest - 11, // 14: chat.ChatService.History:input_type -> chat.HistoryRequest - 13, // 15: chat.ChatService.Subscribe:input_type -> chat.SubscribeRequest - 14, // 16: chat.ChatService.Acknowledge:input_type -> chat.AcknowledgeRequest - 5, // 17: chat.ChatService.ListTopics:output_type -> chat.ListTopicsResponse - 2, // 18: chat.ChatService.GetTopic:output_type -> chat.Topic - 2, // 19: chat.ChatService.CreateTopic:output_type -> chat.Topic - 9, // 20: chat.ChatService.PostMessage:output_type -> chat.PostMessageResponse - 3, // 21: chat.ChatService.GetMessage:output_type -> chat.Message - 12, // 22: chat.ChatService.History:output_type -> chat.HistoryResponse - 3, // 23: chat.ChatService.Subscribe:output_type -> chat.Message - 15, // 24: chat.ChatService.Acknowledge:output_type -> chat.AcknowledgeResponse - 17, // [17:25] is the sub-list for method output_type - 9, // [9:17] is the sub-list for method input_type + 8, // 12: chat.ChatService.UpdateTopic:input_type -> chat.UpdateTopicRequest + 9, // 13: chat.ChatService.PostMessage:input_type -> chat.PostMessageRequest + 11, // 14: chat.ChatService.GetMessage:input_type -> chat.GetMessageRequest + 12, // 15: chat.ChatService.History:input_type -> chat.HistoryRequest + 14, // 16: chat.ChatService.Subscribe:input_type -> chat.SubscribeRequest + 15, // 17: chat.ChatService.Acknowledge:input_type -> chat.AcknowledgeRequest + 5, // 18: chat.ChatService.ListTopics:output_type -> chat.ListTopicsResponse + 2, // 19: chat.ChatService.GetTopic:output_type -> chat.Topic + 2, // 20: chat.ChatService.CreateTopic:output_type -> chat.Topic + 2, // 21: chat.ChatService.UpdateTopic:output_type -> chat.Topic + 10, // 22: chat.ChatService.PostMessage:output_type -> chat.PostMessageResponse + 3, // 23: chat.ChatService.GetMessage:output_type -> chat.Message + 13, // 24: chat.ChatService.History:output_type -> chat.HistoryResponse + 3, // 25: chat.ChatService.Subscribe:output_type -> chat.Message + 16, // 26: chat.ChatService.Acknowledge:output_type -> chat.AcknowledgeResponse + 18, // [18:27] is the sub-list for method output_type + 9, // [9:18] is the sub-list for method input_type 9, // [9:9] is the sub-list for extension type_name 9, // [9:9] is the sub-list for extension extendee 0, // [0:9] is the sub-list for field type_name @@ -1193,14 +1252,14 @@ func file_chat_proto_init() { (*GetTopicRequest_Id)(nil), (*GetTopicRequest_Slug)(nil), } - file_chat_proto_msgTypes[6].OneofWrappers = []any{} + file_chat_proto_msgTypes[7].OneofWrappers = []any{} type x struct{} out := protoimpl.TypeBuilder{ File: protoimpl.DescBuilder{ GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: unsafe.Slice(unsafe.StringData(file_chat_proto_rawDesc), len(file_chat_proto_rawDesc)), NumEnums: 2, - NumMessages: 14, + NumMessages: 15, NumExtensions: 0, NumServices: 1, }, diff --git a/chat.proto b/chat.proto index cf42254..a3b14b9 100644 --- a/chat.proto +++ b/chat.proto @@ -19,6 +19,11 @@ service ChatService { // CreateTopic creates a new topic. Slug must be unique. rpc CreateTopic(CreateTopicRequest) returns (Topic); + // UpdateTopic renames a topic (display_name). The slug is a stable + // identifier and cannot be changed. Topics are persistent in the MVP: + // there is no delete API. + rpc UpdateTopic(UpdateTopicRequest) returns (Topic); + // PostMessage appends a message to a topic. Repeated calls with the same // (author_id, idempotency_key) must not create a second message; the // original message is returned with duplicated=true instead. @@ -102,6 +107,11 @@ message CreateTopicRequest { string display_name = 2; } +message UpdateTopicRequest { + string id = 1; // UUID + string display_name = 2; // new display name (required, full replace) +} + message PostMessageRequest { string topic_id = 1; string author_id = 2; diff --git a/chat_grpc.pb.go b/chat_grpc.pb.go index 7c2634e..2c9f706 100644 --- a/chat_grpc.pb.go +++ b/chat_grpc.pb.go @@ -22,6 +22,7 @@ const ( ChatService_ListTopics_FullMethodName = "/chat.ChatService/ListTopics" ChatService_GetTopic_FullMethodName = "/chat.ChatService/GetTopic" ChatService_CreateTopic_FullMethodName = "/chat.ChatService/CreateTopic" + ChatService_UpdateTopic_FullMethodName = "/chat.ChatService/UpdateTopic" ChatService_PostMessage_FullMethodName = "/chat.ChatService/PostMessage" ChatService_GetMessage_FullMethodName = "/chat.ChatService/GetMessage" ChatService_History_FullMethodName = "/chat.ChatService/History" @@ -43,6 +44,10 @@ type ChatServiceClient interface { GetTopic(ctx context.Context, in *GetTopicRequest, opts ...grpc.CallOption) (*Topic, error) // CreateTopic creates a new topic. Slug must be unique. CreateTopic(ctx context.Context, in *CreateTopicRequest, opts ...grpc.CallOption) (*Topic, error) + // UpdateTopic renames a topic (display_name). The slug is a stable + // identifier and cannot be changed. Topics are persistent in the MVP: + // there is no delete API. + UpdateTopic(ctx context.Context, in *UpdateTopicRequest, opts ...grpc.CallOption) (*Topic, error) // PostMessage appends a message to a topic. Repeated calls with the same // (author_id, idempotency_key) must not create a second message; the // original message is returned with duplicated=true instead. @@ -100,6 +105,16 @@ func (c *chatServiceClient) CreateTopic(ctx context.Context, in *CreateTopicRequ return out, nil } +func (c *chatServiceClient) UpdateTopic(ctx context.Context, in *UpdateTopicRequest, opts ...grpc.CallOption) (*Topic, error) { + cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) + out := new(Topic) + err := c.cc.Invoke(ctx, ChatService_UpdateTopic_FullMethodName, in, out, cOpts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *chatServiceClient) PostMessage(ctx context.Context, in *PostMessageRequest, opts ...grpc.CallOption) (*PostMessageResponse, error) { cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) out := new(PostMessageResponse) @@ -173,6 +188,10 @@ type ChatServiceServer interface { GetTopic(context.Context, *GetTopicRequest) (*Topic, error) // CreateTopic creates a new topic. Slug must be unique. CreateTopic(context.Context, *CreateTopicRequest) (*Topic, error) + // UpdateTopic renames a topic (display_name). The slug is a stable + // identifier and cannot be changed. Topics are persistent in the MVP: + // there is no delete API. + UpdateTopic(context.Context, *UpdateTopicRequest) (*Topic, error) // PostMessage appends a message to a topic. Repeated calls with the same // (author_id, idempotency_key) must not create a second message; the // original message is returned with duplicated=true instead. @@ -209,6 +228,9 @@ func (UnimplementedChatServiceServer) GetTopic(context.Context, *GetTopicRequest func (UnimplementedChatServiceServer) CreateTopic(context.Context, *CreateTopicRequest) (*Topic, error) { return nil, status.Error(codes.Unimplemented, "method CreateTopic not implemented") } +func (UnimplementedChatServiceServer) UpdateTopic(context.Context, *UpdateTopicRequest) (*Topic, error) { + return nil, status.Error(codes.Unimplemented, "method UpdateTopic not implemented") +} func (UnimplementedChatServiceServer) PostMessage(context.Context, *PostMessageRequest) (*PostMessageResponse, error) { return nil, status.Error(codes.Unimplemented, "method PostMessage not implemented") } @@ -299,6 +321,24 @@ func _ChatService_CreateTopic_Handler(srv interface{}, ctx context.Context, dec return interceptor(ctx, in, info, handler) } +func _ChatService_UpdateTopic_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(UpdateTopicRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(ChatServiceServer).UpdateTopic(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: ChatService_UpdateTopic_FullMethodName, + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(ChatServiceServer).UpdateTopic(ctx, req.(*UpdateTopicRequest)) + } + return interceptor(ctx, in, info, handler) +} + func _ChatService_PostMessage_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(PostMessageRequest) if err := dec(in); err != nil { @@ -401,6 +441,10 @@ var ChatService_ServiceDesc = grpc.ServiceDesc{ MethodName: "CreateTopic", Handler: _ChatService_CreateTopic_Handler, }, + { + MethodName: "UpdateTopic", + Handler: _ChatService_UpdateTopic_Handler, + }, { MethodName: "PostMessage", Handler: _ChatService_PostMessage_Handler,