From 610682d60834d75aecc76e5d7891b5d7e0cf22db Mon Sep 17 00:00:00 2001 From: NickWang Date: Thu, 16 Jun 2022 14:27:07 +0800 Subject: [PATCH 1/3] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20channel=20proto?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- proto/wechaty/puppet.proto | 13 +++++++++++++ proto/wechaty/puppet/channel.proto | 17 +++++++++++++++++ proto/wechaty/puppet/message.proto | 19 +++++++++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 proto/wechaty/puppet/channel.proto diff --git a/proto/wechaty/puppet.proto b/proto/wechaty/puppet.proto index ba8d239e..07c70b3c 100644 --- a/proto/wechaty/puppet.proto +++ b/proto/wechaty/puppet.proto @@ -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"; @@ -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" @@ -357,6 +364,12 @@ service Puppet { body: "*" }; } + rpc MessageSendChannel (puppet.MessageSendChannelRequest) returns (puppet.MessageSendChannelResponse) { + option (google.api.http) = { + post: "/conversations/{conversation_id}/channel" + body: "*" + }; + } /** * diff --git a/proto/wechaty/puppet/channel.proto b/proto/wechaty/puppet/channel.proto new file mode 100644 index 00000000..5f00f8e1 --- /dev/null +++ b/proto/wechaty/puppet/channel.proto @@ -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; +} diff --git a/proto/wechaty/puppet/message.proto b/proto/wechaty/puppet/message.proto index 8b7785aa..bad06094 100644 --- a/proto/wechaty/puppet/message.proto +++ b/proto/wechaty/puppet/message.proto @@ -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; @@ -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 { @@ -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; @@ -228,3 +238,12 @@ message MessageSendLocationResponse { */ string id = 1; } + +message MessageSendChannelRequest { + string conversation_id = 1; + ChannelPayload channel = 2; +} +message MessageSendChannelResponse { + string id = 1; +} + From 2d33bb1560672401c654e535666c0e9d82b5bfb4 Mon Sep 17 00:00:00 2001 From: NickWang Date: Thu, 16 Jun 2022 14:27:44 +0800 Subject: [PATCH 2/3] =?UTF-8?q?test:=20=F0=9F=92=8D=20add=20channel=20to?= =?UTF-8?q?=20test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/puppet-server-impl.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/puppet-server-impl.ts b/tests/puppet-server-impl.ts index 82af6841..863d577f 100644 --- a/tests/puppet-server-impl.ts +++ b/tests/puppet-server-impl.ts @@ -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 From b6db79bac64b8e5c79df5c535831d22beb662b3f Mon Sep 17 00:00:00 2001 From: NickWang Date: Thu, 16 Jun 2022 14:28:47 +0800 Subject: [PATCH 3/3] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20commonjs=20export?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- commonjs/generated/puppet.cjs | 1 + commonjs/generated/puppet.cjs.d.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/commonjs/generated/puppet.cjs b/commonjs/generated/puppet.cjs index 9fadd30e..a4112e56 100644 --- a/commonjs/generated/puppet.cjs +++ b/commonjs/generated/puppet.cjs @@ -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', diff --git a/commonjs/generated/puppet.cjs.d.ts b/commonjs/generated/puppet.cjs.d.ts index b3fc9932..70e03503 100644 --- a/commonjs/generated/puppet.cjs.d.ts +++ b/commonjs/generated/puppet.cjs.d.ts @@ -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'