Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve stream message #95

Merged
merged 11 commits into from
Oct 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@chatie/grpc",
"version": "0.18.3",
"version": "0.18.7",
"description": "gRPC for Chatie",
"main": "dist/src/index.js",
"typings": "dist/src/index.d.js",
Expand Down
30 changes: 21 additions & 9 deletions proto/wechaty/puppet.proto
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ option go_package="github.com/wechaty/go-grpc/wechaty";
import public "puppet/base.proto";
import public "puppet/contact.proto";
import public "puppet/event.proto";
import public "puppet/filebox.proto";
import public "puppet/friendship.proto";
import public "puppet/message.proto";
import public "puppet/room.proto";
Expand Down Expand Up @@ -90,22 +91,33 @@ service Puppet {
* Message
*
*/
rpc MessagePayload (puppet.MessagePayloadRequest) returns (puppet.MessagePayloadResponse) {}

rpc MessageContact (puppet.MessageContactRequest) returns (puppet.MessageContactResponse) {}
// @deprecated: using MessageFileStream to transfer files
/**
* @deprecated: using MessageFileStream to transfer files
* Huan(202010): will be removed (replaced by MessageFileStream) after Dec 31, 2021
*/
rpc MessageFile (puppet.MessageFileRequest) returns (puppet.MessageFileResponse) {}
rpc MessageFileStream (puppet.MessageFileStreamRequest) returns (stream puppet.FileBoxChunk) {}
// @deprecated: using MessageImageStream to transfer images
/**
* @deprecated: using MessageImageStream to transfer images
* Huan(202010): will be removed (replaced by MessageImageStream) after Dec 31, 2021
*/
rpc MessageImage (puppet.MessageImageRequest) returns (puppet.MessageImageResponse) {}
rpc MessageImageStream (puppet.MessageImageStreamRequest) returns (stream puppet.FileBoxChunk) {}
/**
* @deprecated: using MesageSendFileStream to transfer file message to server
* Huan(202010): will be removed (replaced by MessageSendFileStream) after Dec 31, 2021
*/
rpc MessageSendFile (puppet.MessageSendFileRequest) returns (puppet.MessageSendFileResponse) {}

rpc MessagePayload (puppet.MessagePayloadRequest) returns (puppet.MessagePayloadResponse) {}

rpc MessageContact (puppet.MessageContactRequest) returns (puppet.MessageContactResponse) {}
rpc MessageFileStream (puppet.MessageFileStreamRequest) returns (stream puppet.MessageFileStreamResponse) {}
rpc MessageImageStream (puppet.MessageImageStreamRequest) returns (stream puppet.MessageImageStreamResponse) {}
rpc MessageMiniProgram (puppet.MessageMiniProgramRequest) returns (puppet.MessageMiniProgramResponse) {}
rpc MessageUrl (puppet.MessageUrlRequest) returns (puppet.MessageUrlResponse) {}

rpc MessageSendContact (puppet.MessageSendContactRequest) returns (puppet.MessageSendContactResponse) {}
// @deprecated: using MesageSendFileStream to transfer file message to server
rpc MessageSendFile (puppet.MessageSendFileRequest) returns (puppet.MessageSendFileResponse) {}
rpc MessageSendFileStream (stream puppet.FileBoxChunk) returns (puppet.MessageSendFileStreamResponse) {}
rpc MessageSendFileStream (stream puppet.MessageSendFileStreamRequest) returns (puppet.MessageSendFileStreamResponse) {}
rpc MessageSendText (puppet.MessageSendTextRequest) returns (puppet.MessageSendTextResponse) {}
rpc MessageSendMiniProgram (puppet.MessageSendMiniProgramRequest) returns (puppet.MessageSendMiniProgramResponse) {}
rpc MessageSendUrl (puppet.MessageSendUrlRequest) returns (puppet.MessageSendUrlResponse) {}
Expand Down
9 changes: 9 additions & 0 deletions proto/wechaty/puppet/filebox.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
syntax = "proto3";
package wechaty.puppet;

message FileBoxChunk {
oneof payload {
bytes data = 1;
string name = 2;
}
}
18 changes: 14 additions & 4 deletions proto/wechaty/puppet/message.proto
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ option csharp_namespace = "github.wechaty.grpc.puppet";

import "google/protobuf/wrappers.proto";

import "puppet/filebox.proto";

enum MessageType {
MESSAGE_TYPE_UNSPECIFIED = 0;

Expand Down Expand Up @@ -48,10 +50,6 @@ message MessagePayloadResponse {
repeated string mention_ids = 9;
}

message FileBoxChunk {
bytes data = 1;
}

message MessageImageRequest {
string id = 1;
ImageType type = 2;
Expand All @@ -64,6 +62,9 @@ message MessageImageStreamRequest {
string id = 1;
ImageType type = 2;
}
message MessageImageStreamResponse {
FileBoxChunk file_box_chunk = 1;
}

message MessageContactRequest {
string id = 1;
Expand All @@ -82,6 +83,9 @@ message MessageFileResponse {
message MessageFileStreamRequest {
string id = 1;
}
message MessageFileStreamResponse {
FileBoxChunk file_box_chunk = 1;
}

message MessageMiniProgramRequest {
string id = 1;
Expand Down Expand Up @@ -114,6 +118,12 @@ message MessageSendFileResponse {
google.protobuf.StringValue id = 1;
}

message MessageSendFileStreamRequest {
oneof payload {
string conversation_id = 1;
FileBoxChunk file_box_chunk = 2;
};
}
message MessageSendFileStreamResponse {
google.protobuf.StringValue id = 1;
}
Expand Down