Skip to content

Feat/channel message wechaty #190

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions commonjs/generated/puppet.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const puppetFileList = [
'../../out/wechaty/puppet/room-member_pb.js',
'../../out/wechaty/puppet/tag_pb.js',
'../../out/wechaty/puppet/url-link_pb.js',
'../../out/wechaty/puppet/channel_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 @@ -37,6 +37,7 @@ export * from '../../out/wechaty/puppet/room-invitation_pb.js'
export * from '../../out/wechaty/puppet/room-member_pb.js'
export * from '../../out/wechaty/puppet/tag_pb.js'
export * from '../../out/wechaty/puppet/url-link_pb.js'
export * from '../../out/wechaty/puppet/channel_pb.js'

export * from '../../out/wechaty/puppet_grpc_pb.js'
export * from '../../out/wechaty/puppet_pb.js'
13 changes: 13 additions & 0 deletions proto/wechaty/puppet.proto
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ import "wechaty/puppet/room-invitation.proto";
import "wechaty/puppet/room-member.proto";
import "wechaty/puppet/room.proto";
import "wechaty/puppet/tag.proto";
import "wechaty/puppet/channel.proto";


option java_package="io.github.wechaty.grpc";
option go_package="github.com/wechaty/go-grpc/wechaty";
Expand Down Expand Up @@ -308,6 +310,11 @@ service Puppet {
get: "/message/{id}/url-link"
};
}
rpc MessageChannel (puppet.MessageChannelRequest) returns (puppet.MessageChannelResponse) {
option (google.api.http) = {
get: "/message/{id}/channel"
};
}
rpc MessageRecall (puppet.MessageRecallRequest) returns (puppet.MessageRecallResponse) {
option (google.api.http) = {
put: "/message/{id}/recall"
Expand Down Expand Up @@ -357,6 +364,12 @@ service Puppet {
body: "*"
};
}
rpc MessageSendChannel (puppet.MessageSendChannelRequest) returns (puppet.MessageSendChannelResponse) {
option (google.api.http) = {
post: "/conversations/{conversation_id}/channel"
body: "*"
};
}

/**
*
Expand Down
17 changes: 17 additions & 0 deletions proto/wechaty/puppet/channel.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
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";

message ChannelPayload {
string avatar = 1;
string cover_url = 2;
string desc = 3;
string extras = 4;
int32 feed_type = 5;
string nickname = 6;
string thumb_url = 7;
string url = 8;
}
19 changes: 19 additions & 0 deletions proto/wechaty/puppet/message.proto
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import "wechaty/puppet/image.proto";
import "wechaty/puppet/location.proto";
import "wechaty/puppet/mini-program.proto";
import "wechaty/puppet/url-link.proto";
import "wechaty/puppet/channel.proto";


enum MessageType {
MESSAGE_TYPE_UNSPECIFIED = 0;
Expand All @@ -36,6 +38,7 @@ enum MessageType {
MESSAGE_TYPE_RED_ENVELOPE = 12;
MESSAGE_TYPE_RECALLED = 13;
MESSAGE_TYPE_URL = 14;
MESSAGE_TYPE_CHANNEL = 15;
}

message MessagePayloadRequest {
Expand Down Expand Up @@ -104,6 +107,13 @@ message MessageUrlResponse {
UrlLinkPayload url_link = 2;
}

message MessageChannelRequest {
string id = 1;
}
message MessageChannelResponse {
ChannelPayload channel = 1;
}

message MessageSendContactRequest {
string conversation_id = 1;
string contact_id = 2;
Expand Down Expand Up @@ -228,3 +238,12 @@ message MessageSendLocationResponse {
*/
string id = 1;
}

message MessageSendChannelRequest {
string conversation_id = 1;
ChannelPayload channel = 2;
}
message MessageSendChannelResponse {
string id = 1;
}

12 changes: 12 additions & 0 deletions tests/puppet-server-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,18 @@ export const puppetServerImpl: IPuppetServer = {
throw new Error('not implemented.')
},

messageSendChannel: (call, callback) => {
void call
void callback
throw new Error('not implemented.')
},

messageChannel: (call, callback) => {
void call
void callback
throw new Error('not implemented.')
},

roomAdd: (call, callback) => {
void call
void callback
Expand Down