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' diff --git a/proto/wechaty/puppet.proto b/proto/wechaty/puppet.proto index c9cccab3..49801960 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"; import "wechaty/puppet/conversation.proto"; option java_package="io.github.wechaty.grpc"; @@ -484,6 +485,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/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 {} 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..4b082189 --- /dev/null +++ b/proto/wechaty/puppet/post.proto @@ -0,0 +1,99 @@ +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 = 2; + + optional string parentId = 3; + optional string root_id = 4; + optional PostType type = 5; + + string contact_id = 6; + int32 timestamp = 7; + + Counter counter = 8; +} + +message PostPayloadClient { + string id = 1; + repeated string sayable = 2; + + optional string parentId = 3; + optional string root_id = 4; + optional PostType type = 5; +} + +message PostQueryFilter { + optional string contact_id = 1; + optional string id = 2; + optional string order_by = 3; + optional string parent_id = 4; + optional string root_id = 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; + } diff --git a/tests/puppet-server-impl.ts b/tests/puppet-server-impl.ts index 8b7823ea..cff453da 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