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

add dirty rpc function definition for sync data #79

Merged
merged 16 commits into from
Aug 19, 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.17.1",
"version": "0.17.2",
"description": "gRPC for Chatie",
"main": "dist/src/index.js",
"typings": "dist/src/index.d.js",
Expand Down
2 changes: 2 additions & 0 deletions proto/wechaty/puppet.proto
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ service Puppet {
*/
rpc Event (puppet.EventRequest) returns (stream puppet.EventResponse) {}

rpc DirtyPayload (puppet.DirtyPayloadRequest) returns (puppet.DirtyPayloadResponse) {}

/**
*
* Contact Self
Expand Down
16 changes: 16 additions & 0 deletions proto/wechaty/puppet/base.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ package wechaty.puppet;
option go_package="github.com/wechaty/go-grpc/wechaty/puppet";
option java_package="io.github.wechaty.grpc.puppet";

enum PayloadType {
PAYLOAD_TYPE_UNKNOWN = 0;
PAYLOAD_TYPE_MESSAGE = 1;
PAYLOAD_TYPE_CONTACT = 2;
PAYLOAD_TYPE_ROOM = 3;
PAYLOAD_TYPE_ROOM_MEMBER = 4;
PAYLOAD_TYPE_FRIENDSHIP = 5;
}

message StartRequest {}
message StartResponse {}

Expand All @@ -25,3 +34,10 @@ message DingResponse {
// Ding has no return value
// Puppet should emit a `ding` event when it receives a `ding()` call
}

message DirtyPayloadRequest {
PayloadType type = 1;
string id = 2;
}

message DirtyPayloadResponse {}
1 change: 1 addition & 0 deletions proto/wechaty/puppet/event.proto
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ enum EventType {
EVENT_TYPE_RESET = 24;
EVENT_TYPE_LOGIN = 25;
EVENT_TYPE_LOGOUT = 26;
EVENT_TYPE_DIRTY = 27;
}

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

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

event: (streamnigCall) => {
void streamnigCall
throw new Error('not implmented.')
Expand Down