add ID to grpc (#641)

Co-authored-by: rsmnarts <risman.zainuri@bluebirdgroup.com>
This commit is contained in:
rsmnarts 2021-11-03 21:14:46 +07:00 committed by GitHub
parent 9d47494585
commit eac2553b25
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 21 additions and 5 deletions

View File

@ -1,3 +1,4 @@
//go:build lambda
// +build lambda
package router

View File

@ -1,3 +1,4 @@
//go:build !lambda
// +build !lambda
package router

View File

@ -1,7 +1,7 @@
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.25.0-devel
// protoc v3.14.0
// protoc-gen-go v1.27.1
// protoc v3.17.3
// source: gorush.proto
package proto
@ -257,6 +257,7 @@ type NotificationRequest struct {
Data *structpb.Struct `protobuf:"bytes,14,opt,name=data,proto3" json:"data,omitempty"`
Image string `protobuf:"bytes,15,opt,name=image,proto3" json:"image,omitempty"`
Priority NotificationRequest_Priority `protobuf:"varint,16,opt,name=priority,proto3,enum=proto.NotificationRequest_Priority" json:"priority,omitempty"`
ID string `protobuf:"bytes,17,opt,name=ID,proto3" json:"ID,omitempty"`
}
func (x *NotificationRequest) Reset() {
@ -403,6 +404,13 @@ func (x *NotificationRequest) GetPriority() NotificationRequest_Priority {
return NotificationRequest_NORMAL
}
func (x *NotificationRequest) GetID() string {
if x != nil {
return x.ID
}
return ""
}
type NotificationReply struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
@ -576,7 +584,7 @@ var file_gorush_proto_rawDesc = []byte{
0x6f, 0x63, 0x41, 0x72, 0x67, 0x73, 0x18, 0x09, 0x20, 0x03, 0x28, 0x09, 0x52, 0x07, 0x6c, 0x6f,
0x63, 0x41, 0x72, 0x67, 0x73, 0x12, 0x22, 0x0a, 0x0c, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x4c, 0x6f,
0x63, 0x41, 0x72, 0x67, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x09, 0x52, 0x0c, 0x74, 0x69, 0x74,
0x6c, 0x65, 0x4c, 0x6f, 0x63, 0x41, 0x72, 0x67, 0x73, 0x22, 0xa3, 0x04, 0x0a, 0x13, 0x4e, 0x6f,
0x6c, 0x65, 0x4c, 0x6f, 0x63, 0x41, 0x72, 0x67, 0x73, 0x22, 0xb3, 0x04, 0x0a, 0x13, 0x4e, 0x6f,
0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
0x74, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28,
0x09, 0x52, 0x06, 0x74, 0x6f, 0x6b, 0x65, 0x6e, 0x73, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x6c, 0x61,
@ -608,7 +616,8 @@ var file_gorush_proto_rawDesc = []byte{
0x70, 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x18, 0x10, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x23,
0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74,
0x69, 0x6f, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x50, 0x72, 0x69, 0x6f, 0x72,
0x69, 0x74, 0x79, 0x52, 0x08, 0x70, 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x22, 0x20, 0x0a,
0x69, 0x74, 0x79, 0x52, 0x08, 0x70, 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x12, 0x0e, 0x0a,
0x02, 0x49, 0x44, 0x18, 0x11, 0x20, 0x01, 0x28, 0x09, 0x52, 0x02, 0x49, 0x44, 0x22, 0x20, 0x0a,
0x08, 0x50, 0x72, 0x69, 0x6f, 0x72, 0x69, 0x74, 0x79, 0x12, 0x0a, 0x0a, 0x06, 0x4e, 0x4f, 0x52,
0x4d, 0x41, 0x4c, 0x10, 0x00, 0x12, 0x08, 0x0a, 0x04, 0x48, 0x49, 0x47, 0x48, 0x10, 0x01, 0x22,
0x45, 0x0a, 0x11, 0x4e, 0x6f, 0x74, 0x69, 0x66, 0x69, 0x63, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52,
@ -637,7 +646,8 @@ var file_gorush_proto_rawDesc = []byte{
0x6f, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71,
0x75, 0x65, 0x73, 0x74, 0x1a, 0x1a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x48, 0x65, 0x61,
0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x42, 0x0a, 0x5a, 0x08, 0x2e, 0x2f, 0x3b, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72,
0x6f, 0x74, 0x6f, 0x33,
}
var (

View File

@ -3,6 +3,8 @@ import "google/protobuf/struct.proto";
package proto;
// option go_package = "./;proto";
message Alert {
string title = 1;
string body = 2;
@ -37,6 +39,7 @@ message NotificationRequest {
HIGH = 1;
}
Priority priority = 16;
string ID = 17;
}
message NotificationReply {

View File

@ -56,6 +56,7 @@ func (s *Server) Check(ctx context.Context, in *proto.HealthCheckRequest) (*prot
func (s *Server) Send(ctx context.Context, in *proto.NotificationRequest) (*proto.NotificationReply, error) {
badge := int(in.Badge)
notification := notify.PushNotification{
ID: in.ID,
Platform: int(in.Platform),
Tokens: in.Tokens,
Message: in.Message,