Skip to content

Commit

Permalink
Use well known type google.protobuf.Empty (ThreeDotsLabs#20)
Browse files Browse the repository at this point in the history
[gRPC] Use well known type google.protobuf.Empty
  • Loading branch information
maratori authored Apr 4, 2021
1 parent a45f0b5 commit 13cd6af
Show file tree
Hide file tree
Showing 7 changed files with 75 additions and 134 deletions.
9 changes: 4 additions & 5 deletions api/protobuf/trainer.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ syntax = "proto3";

package trainer;

import "google/protobuf/empty.proto";
import "google/protobuf/timestamp.proto";

service TrainerService {
rpc IsHourAvailable(IsHourAvailableRequest) returns (IsHourAvailableResponse) {}
rpc ScheduleTraining(UpdateHourRequest) returns (EmptyResponse) {}
rpc CancelTraining(UpdateHourRequest) returns (EmptyResponse) {}
rpc MakeHourAvailable(UpdateHourRequest) returns (EmptyResponse) {}
rpc ScheduleTraining(UpdateHourRequest) returns (google.protobuf.Empty) {}
rpc CancelTraining(UpdateHourRequest) returns (google.protobuf.Empty) {}
rpc MakeHourAvailable(UpdateHourRequest) returns (google.protobuf.Empty) {}
}

message IsHourAvailableRequest {
Expand All @@ -22,5 +23,3 @@ message IsHourAvailableResponse {
message UpdateHourRequest {
google.protobuf.Timestamp time = 1;
}

message EmptyResponse {}
6 changes: 3 additions & 3 deletions api/protobuf/users.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ syntax = "proto3";

package users;

import "google/protobuf/empty.proto";

service UsersService {
rpc GetTrainingBalance(GetTrainingBalanceRequest) returns (GetTrainingBalanceResponse) {}
rpc UpdateTrainingBalance(UpdateTrainingBalanceRequest) returns (EmptyResponse) {}
rpc UpdateTrainingBalance(UpdateTrainingBalanceRequest) returns (google.protobuf.Empty) {}
}

message GetTrainingBalanceRequest {
Expand All @@ -19,5 +21,3 @@ message UpdateTrainingBalanceRequest {
string user_id = 1;
int64 amount_change = 2;
}

message EmptyResponse {}
101 changes: 35 additions & 66 deletions internal/common/genproto/trainer/trainer.pb.go

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

74 changes: 22 additions & 52 deletions internal/common/genproto/users/users.pb.go

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

Loading

0 comments on commit 13cd6af

Please sign in to comment.