Skip to content

Commit

Permalink
feat: new bertychat service (protobuf + go)
Browse files Browse the repository at this point in the history
  • Loading branch information
moul committed May 28, 2020
1 parent ce3fe55 commit 4cc7345
Show file tree
Hide file tree
Showing 25 changed files with 1,140 additions and 121 deletions.
44 changes: 44 additions & 0 deletions api/bertychat.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
syntax = "proto3";

package berty.chat;

import "github.com/gogo/protobuf/gogoproto/gogo.proto";
//import "bertytypes.proto";

option go_package = "berty.tech/berty/go/pkg/bertychat";

// ChatService is the top-level API that uses the Berty Protocol to implement the Berty Chat specific logic.
// Today, most of the Berty Chat logic is implemented directly in the application (see the /js folder of this repo).
service ChatService {
// InstanceShareableBertyID returns a Berty ID that can be shared as a string, QR code or deep link.
rpc InstanceShareableBertyID(InstanceShareableBertyID.Request) returns (InstanceShareableBertyID.Reply);

// DevShareInstanceBertyID shares your Berty ID on a dev channel.
// TODO: remove for public.
rpc DevShareInstanceBertyID(DevShareInstanceBertyID.Request) returns (DevShareInstanceBertyID.Reply);
}

message InstanceShareableBertyID {
message Request {
// reset will regenerate a new link
bool reset = 1;

string display_name = 2;
}
message Reply {
string berty_id = 1 [(gogoproto.customname) = "BertyID"];
string deep_link = 2 [(gogoproto.customname) = "DeepLink"];
string html_url = 3 [(gogoproto.customname) = "HTMLURL"];
string display_name = 4;
}
}

message DevShareInstanceBertyID {
message Request {
// reset will regenerate a new link
bool reset = 1;

string display_name = 2;
}
message Reply {}
}
2 changes: 2 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,10 @@ PROTOC_OPTS = -I ../vendor/github.com/grpc-ecosystem/grpc-gateway:../api:../vend
.PHONY: generate_local
generate_local:
protoc $(PROTOC_OPTS) --doc_out=./protocol --doc_opt=markdown,api.md.tmp ../api/bertyprotocol.proto ../api/bertytypes.proto
protoc $(PROTOC_OPTS) --doc_out=./chat --doc_opt=markdown,api.md.tmp ../api/bertychat.proto
@# repace multiple empty lines with one
cat protocol/api.md.tmp | sed '/^$$/N;/^\n$$/D' > protocol/api.md
cat chat/api.md.tmp | sed '/^$$/N;/^\n$$/D' > chat/api.md
rm -f */*.md.tmp
shasum $(GEN_SRC) | sort -k 2 > $(GEN_SUM).tmp
mv $(GEN_SUM).tmp $(GEN_SUM)
102 changes: 102 additions & 0 deletions docs/chat/api.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion docs/gen.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions go.mod

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4cc7345

Please sign in to comment.