From 140639cb051fe30362a29de2450ed19355a73517 Mon Sep 17 00:00:00 2001 From: NickWang Date: Fri, 27 May 2022 16:43:43 +0800 Subject: [PATCH 1/8] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20post=20grpcs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- proto/wechaty/puppet.proto | 23 +++++++ proto/wechaty/puppet/pagination.proto | 11 ++++ proto/wechaty/puppet/post.proto | 91 +++++++++++++++++++++++++++ proto/wechaty/puppet/tap.proto | 16 +++++ 4 files changed, 141 insertions(+) create mode 100644 proto/wechaty/puppet/pagination.proto create mode 100644 proto/wechaty/puppet/post.proto create mode 100644 proto/wechaty/puppet/tap.proto diff --git a/proto/wechaty/puppet.proto b/proto/wechaty/puppet.proto index ba8d239e..50fca097 100644 --- a/proto/wechaty/puppet.proto +++ b/proto/wechaty/puppet.proto @@ -28,6 +28,7 @@ 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/post.proto"; option java_package="io.github.wechaty.grpc"; option go_package="github.com/wechaty/go-grpc/wechaty"; @@ -471,6 +472,28 @@ service Puppet { }; } + /** + * + * Post + * + */ + rpc PostPayload (puppet.PostPayloadRequest) returns (puppet.PostPayloadResponse) { + option (google.api.http) = { + get: "/posts/{id}" + }; + } + + rpc PostSearch (puppet.PostSearchRequest) returns (puppet.PostSearchResponse) { + } + + rpc PostPublish (puppet.PostPublishRequest) returns (puppet.PostPublishResponse) { + option (google.api.http) = { + post: "/posts/publish" + body: "*" + }; + } + + /** * Operate Sub-Collections * https://cloud.google.com/apis/design/design_patterns#list_sub-collections diff --git a/proto/wechaty/puppet/pagination.proto b/proto/wechaty/puppet/pagination.proto new file mode 100644 index 00000000..4c9d3da4 --- /dev/null +++ b/proto/wechaty/puppet/pagination.proto @@ -0,0 +1,11 @@ +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 PaginationRequest { + optional int32 page_size = 1; + optional string page_token = 2; +} diff --git a/proto/wechaty/puppet/post.proto b/proto/wechaty/puppet/post.proto new file mode 100644 index 00000000..b8fd29b4 --- /dev/null +++ b/proto/wechaty/puppet/post.proto @@ -0,0 +1,91 @@ +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 "google/protobuf/timestamp.proto"; + +/** + * @deprecated + * Huan(202109): will be removed after Dec 31, 2022 + * https://cloud.google.com/apis/design/design_patterns#optional_primitive_fields + */ +import "google/protobuf/wrappers.proto"; + +import "wechaty/puppet/tap.proto"; +import "wechaty/puppet/pagination.proto"; + +enum PostType { + POST_TYPE_UNSPECIFIED = 0; + + POST_TYPE_MOMENT = 1; + POST_TYPE_CHANNEL = 2; + POST_TYPE_MESSAGE = 3; +} + +message Counter { + optional int32 children = 1; + optional int32 descendant = 2; + + Taps taps = 3; +} + +message PostPayloadRequest { + string id = 1; +} + +message PostPayloadResponse { + oneof PostPayload { + PostPayloadServer post_payload_server = 1; + PostPayloadClient post_payload_client = 2; + } +} + +message PostSearchRequest { + PostQueryFilter filter = 1; + optional PaginationRequest pagination = 2; +} + +message PostSearchResponse { + optional string next_page_token = 1; + repeated string response = 2; +} + +message PostPublishRequest { + oneof PostPayload { + PostPayloadServer post_payload_server = 1; + PostPayloadClient post_payload_client = 2; + } +} + +message PostPublishResponse { + optional string id = 1; +} + + +message PostPayloadServer { + string id = 1; + repeated string sayable_list = 2; + + string contact_id = 3; + int32 timestamp = 4; + + Counter counter = 5; +} + +message PostPayloadClient { + string id = 1; + repeated string sayable_list = 2; +} + +message PostQueryFilter { + optional string contact_id = 1; + optional string id = 2; + optional string orderBy = 3; + optional string parentId = 4; + optional string rootId = 5; + optional PostType type = 6; +} + diff --git a/proto/wechaty/puppet/tap.proto b/proto/wechaty/puppet/tap.proto new file mode 100644 index 00000000..25b30279 --- /dev/null +++ b/proto/wechaty/puppet/tap.proto @@ -0,0 +1,16 @@ +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"; + +enum TapType { + TAP_TYPE_UNSPECIFIED = 0; + TAP_TYPE_LIKE = 1; +} + +message Taps { + optional int32 unspecified = 1; + optional int32 like = 2; + } From ee1a6fe4823685e11a2f00692cc32115ad48ccae Mon Sep 17 00:00:00 2001 From: NickWang Date: Fri, 27 May 2022 16:46:04 +0800 Subject: [PATCH 2/8] =?UTF-8?q?test:=20=F0=9F=92=8D=20update=20test?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tests/puppet-server-impl.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/puppet-server-impl.ts b/tests/puppet-server-impl.ts index 82af6841..fbece0ed 100644 --- a/tests/puppet-server-impl.ts +++ b/tests/puppet-server-impl.ts @@ -356,6 +356,24 @@ export const puppetServerImpl: IPuppetServer = { throw new Error('not implemented.') }, + postPayload: (call, callback) => { + void call + void callback + throw new Error('not implemented.') + }, + + postSearch: (call, callback) => { + void call + void callback + throw new Error('not implemented.') + }, + + postPublish: (call, callback) => { + void call + void callback + throw new Error('not implemented.') + }, + version: (call, callback) => { void call void callback From 94507595e1ae8745eb70a68e78a417aaa25617f3 Mon Sep 17 00:00:00 2001 From: NickWang Date: Fri, 27 May 2022 16:46:09 +0800 Subject: [PATCH 3/8] 1.5.3 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 656e5b09..9bbdd589 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wechaty-grpc", - "version": "1.5.2", + "version": "1.5.3", "description": "gRPC for Wechaty", "type": "module", "exports": { From 96351f66d71ff7756a880257e38ddbe4eb8e39d4 Mon Sep 17 00:00:00 2001 From: NickWang Date: Fri, 27 May 2022 16:56:04 +0800 Subject: [PATCH 4/8] =?UTF-8?q?fix:=20=F0=9F=90=9B=20var=20naming?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- proto/wechaty/puppet/post.proto | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/proto/wechaty/puppet/post.proto b/proto/wechaty/puppet/post.proto index b8fd29b4..d9dce08d 100644 --- a/proto/wechaty/puppet/post.proto +++ b/proto/wechaty/puppet/post.proto @@ -83,9 +83,9 @@ message PostPayloadClient { message PostQueryFilter { optional string contact_id = 1; optional string id = 2; - optional string orderBy = 3; - optional string parentId = 4; - optional string rootId = 5; + optional string order_by = 3; + optional string parent_id = 4; + optional string root_id = 5; optional PostType type = 6; } From f76531b81ab20e378bf94832fa42e76e551c2717 Mon Sep 17 00:00:00 2001 From: NickWang Date: Fri, 27 May 2022 19:47:45 +0800 Subject: [PATCH 5/8] =?UTF-8?q?fix:=20=F0=9F=90=9B=20post=20payload=20base?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- proto/wechaty/puppet/post.proto | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/proto/wechaty/puppet/post.proto b/proto/wechaty/puppet/post.proto index d9dce08d..0afd7e17 100644 --- a/proto/wechaty/puppet/post.proto +++ b/proto/wechaty/puppet/post.proto @@ -69,15 +69,23 @@ message PostPayloadServer { string id = 1; repeated string sayable_list = 2; - string contact_id = 3; - int32 timestamp = 4; + optional string parentId = 3; + optional string root_id = 4; + optional PostType type = 5; - Counter counter = 5; + string contact_id = 6; + int32 timestamp = 7; + + Counter counter = 8; } message PostPayloadClient { string id = 1; repeated string sayable_list = 2; + + optional string parentId = 3; + optional string root_id = 4; + optional PostType type = 5; } message PostQueryFilter { From f05a6f1c58ad450f08a916ff3af446b8cf59545b Mon Sep 17 00:00:00 2001 From: NickWang Date: Fri, 27 May 2022 19:56:27 +0800 Subject: [PATCH 6/8] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20export=20post=20file?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- commonjs/generated/puppet.cjs | 3 +++ commonjs/generated/puppet.cjs.d.ts | 3 +++ 2 files changed, 6 insertions(+) diff --git a/commonjs/generated/puppet.cjs b/commonjs/generated/puppet.cjs index 9fadd30e..a00eeaf0 100644 --- a/commonjs/generated/puppet.cjs +++ b/commonjs/generated/puppet.cjs @@ -15,6 +15,9 @@ 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/post_pb.js', + '../../out/wechaty/puppet/tap_pb.js', + '../../out/wechaty/puppet/pagination_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..fdaaf462 100644 --- a/commonjs/generated/puppet.cjs.d.ts +++ b/commonjs/generated/puppet.cjs.d.ts @@ -37,6 +37,9 @@ 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/post_pb.js' +export * from '../../out/wechaty/puppet/tap_pb.js' +export * from '../../out/wechaty/puppet/pagination_pb.js' export * from '../../out/wechaty/puppet_grpc_pb.js' export * from '../../out/wechaty/puppet_pb.js' From e441c47b557b5df94738bc2f80fdf321531e870d Mon Sep 17 00:00:00 2001 From: NickWang Date: Fri, 27 May 2022 19:56:37 +0800 Subject: [PATCH 7/8] =?UTF-8?q?feat:=20=F0=9F=8E=B8=20add=20post=20type=20?= =?UTF-8?q?dirty?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- proto/wechaty/puppet/base.proto | 1 + 1 file changed, 1 insertion(+) diff --git a/proto/wechaty/puppet/base.proto b/proto/wechaty/puppet/base.proto index 7270cc2f..2d501186 100644 --- a/proto/wechaty/puppet/base.proto +++ b/proto/wechaty/puppet/base.proto @@ -12,6 +12,7 @@ enum PayloadType { PAYLOAD_TYPE_ROOM = 3; PAYLOAD_TYPE_ROOM_MEMBER = 4; PAYLOAD_TYPE_FRIENDSHIP = 5; + PAYLOAD_TYPE_POSY = 6; } message StartRequest {} From 8ce8609b2e1e6d0f2d386896b6642c00f1e9ab05 Mon Sep 17 00:00:00 2001 From: NickWang Date: Fri, 27 May 2022 21:10:52 +0800 Subject: [PATCH 8/8] =?UTF-8?q?fix:=20=F0=9F=90=9B=20array=20naming?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- proto/wechaty/puppet/post.proto | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/proto/wechaty/puppet/post.proto b/proto/wechaty/puppet/post.proto index 0afd7e17..4b082189 100644 --- a/proto/wechaty/puppet/post.proto +++ b/proto/wechaty/puppet/post.proto @@ -67,7 +67,7 @@ message PostPublishResponse { message PostPayloadServer { string id = 1; - repeated string sayable_list = 2; + repeated string sayable = 2; optional string parentId = 3; optional string root_id = 4; @@ -81,7 +81,7 @@ message PostPayloadServer { message PostPayloadClient { string id = 1; - repeated string sayable_list = 2; + repeated string sayable = 2; optional string parentId = 3; optional string root_id = 4;