Skip to content

Commit

Permalink
feat: ✨ send/get chat history
Browse files Browse the repository at this point in the history
  • Loading branch information
su-chang committed Oct 9, 2023
1 parent 90fcde3 commit 7e9728a
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 1 deletion.
1 change: 1 addition & 0 deletions commonjs/generated/puppet.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ const puppetFileList = [
'../../out/wechaty/puppet/util_pb.js',
'../../out/wechaty/puppet/verify-code_pb.js',
'../../out/wechaty/puppet/call_pb.js',
'../../out/wechaty/puppet/chat-history_pb.js',

'../../out/wechaty/puppet_grpc_pb.js',
'../../out/wechaty/puppet_pb.js',
Expand Down
1 change: 1 addition & 0 deletions commonjs/generated/puppet.cjs.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export * from '../../out/wechaty/puppet/conversation_pb.js'
export * from '../../out/wechaty/puppet/util_pb.js'
export * from '../../out/wechaty/puppet/verify-code_pb.js'
export * from '../../out/wechaty/puppet/call_pb.js'
export * from '../../out/wechaty/puppet/chat-history_pb.js'

export * from '../../out/wechaty/puppet_grpc_pb.js'
export * from '../../out/wechaty/puppet_pb.js'
5 changes: 5 additions & 0 deletions proto/wechaty/puppet.proto
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,11 @@ service Puppet {
get: "/message/{id}/call-record"
};
}
rpc MessageChatHistory (puppet.MessageChatHistoryRequest) returns (puppet.MessageChatHistoryResponse) {
option (google.api.http) = {
get: "/message/{id}/chat-history"
};
}
rpc MessageRecall (puppet.MessageRecallRequest) returns (puppet.MessageRecallResponse) {
option (google.api.http) = {
put: "/message/{id}/recall"
Expand Down
43 changes: 43 additions & 0 deletions proto/wechaty/puppet/chat-history.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
syntax = "proto3";
package wechaty.puppet;

option go_package = "github.com/wechaty/go-grpc/wechaty/puppet";
option java_package = "io.github.wechaty.grpc.puppet";
option csharp_namespace = "github.wechaty.grpc.puppet";

import "location.proto";
import "mini-program.proto";
import "url-link.proto";
import "channel.proto";
import "message.proto";

enum ChatHistoryContentType {
TEXT = 0;
FILE = 1;
LOCATION = 2;
URL = 3;
MINI_PROGRAM = 4;
CHANNEL = 5;
CHAT_HISTORY = 6;
}

message ChatHistoryContent {
ChatHistoryContentType type = 1;
string text = 2;
string file_box = 3;
LocationPayload location = 4;
UrlLinkPayload url_link = 5;
MiniProgramPayload mini_program = 6;
ChannelPayload channel = 7;
repeated ChatHistoryPayload chat_history = 8;
}


message ChatHistoryPayload {
MessageType type = 1;
string avatar = 2;
string sender_name = 3;
string corp_name = 4;
string time = 5;
ChatHistoryContent message = 6;
}
12 changes: 11 additions & 1 deletion proto/wechaty/puppet/message.proto
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import "wechaty/puppet/url-link.proto";
import "wechaty/puppet/channel.proto";
import "wechaty/puppet/post.proto";
import "wechaty/puppet/call.proto";
import "wechaty/puppet/chat-history.proto";


enum MessageType { // 消息类型
Expand Down Expand Up @@ -131,6 +132,13 @@ message MessageCallRecordResponse {
CallRecordPayload call_record = 1;
}

message MessageChatHistoryRequest {
string id = 1;
}
message MessageChatHistoryResponse {
repeated ChatHistoryPayload chat_history_list = 1;
}


message MessageSendContactRequest {
string conversation_id = 1;
Expand Down Expand Up @@ -221,8 +229,10 @@ message MessageRecallResponse {
bool success = 1;
}
message MessageForwardRequest{
string message_id = 1; // 要转发的消息id
// @deprecated: use message_ids instead.
string message_id = 1 [deprecated = true]; // 要转发的消息id
string conversation_id = 2; // 对话id
repeated string message_ids = 3; // 要合并转发的消息id列表
}
message MessageForwardResponse {
/**
Expand Down

0 comments on commit 7e9728a

Please sign in to comment.