chore(grpc): support Priority tag

fix: #492
close: https://github.com/appleboy/gorush/pull/537
This commit is contained in:
Lysak Vladislav 2020-07-31 12:26:58 +03:00 committed by Bo-Yi Wu
parent ae7bc2a4d5
commit dc4e210bec
8 changed files with 992 additions and 509 deletions

4
go.mod
View File

@ -17,7 +17,7 @@ require (
github.com/gin-contrib/logger v0.0.2 github.com/gin-contrib/logger v0.0.2
github.com/gin-gonic/gin v1.6.3 github.com/gin-gonic/gin v1.6.3
github.com/go-redis/redis/v7 v7.2.0 github.com/go-redis/redis/v7 v7.2.0
github.com/golang/protobuf v1.3.5 github.com/golang/protobuf v1.4.1
github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect
github.com/mattn/go-isatty v0.0.12 github.com/mattn/go-isatty v0.0.12
github.com/mitchellh/mapstructure v1.1.2 github.com/mitchellh/mapstructure v1.1.2
@ -43,6 +43,6 @@ require (
golang.org/x/net v0.0.0-20200301022130-244492dfa37a golang.org/x/net v0.0.0-20200301022130-244492dfa37a
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e
golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527 // indirect golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527 // indirect
google.golang.org/genproto v0.0.0-20200313141609-30c55424f95d // indirect
google.golang.org/grpc v1.28.0 google.golang.org/grpc v1.28.0
google.golang.org/protobuf v1.25.0
) )

21
go.sum
View File

@ -119,6 +119,13 @@ github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y
github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw=
github.com/golang/protobuf v1.3.5 h1:F768QJ1E9tib+q5Sc8MkdJi1RxLTbRcTf8LJV56aRls= github.com/golang/protobuf v1.3.5 h1:F768QJ1E9tib+q5Sc8MkdJi1RxLTbRcTf8LJV56aRls=
github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk=
github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8=
github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA=
github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs=
github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w=
github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0=
github.com/golang/protobuf v1.4.1 h1:ZFgWrT+bLgsYPirOnRfKLYJLvssAegOj/hgyMFdJZe0=
github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8=
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db h1:woRePGFeVFfLKN/pOkfl+p/TAqKOfFu+7KPlMVpok/w= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db h1:woRePGFeVFfLKN/pOkfl+p/TAqKOfFu+7KPlMVpok/w=
github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q=
github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4=
@ -128,6 +135,8 @@ github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5a
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1 h1:Xye71clBPdm5HgqGwUkwhbynsUJZhDbS20FvLhQ2izg= github.com/google/go-cmp v0.3.1 h1:Xye71clBPdm5HgqGwUkwhbynsUJZhDbS20FvLhQ2izg=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs=
@ -389,6 +398,7 @@ golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3
golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=
golang.org/x/tools v0.0.0-20190828213141-aed303cbaa74/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190828213141-aed303cbaa74/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/appengine v1.1.0 h1:igQkv0AAhEIvTEpD5LIpAfav2eeVO9HBTjvKHVJPRSs= google.golang.org/appengine v1.1.0 h1:igQkv0AAhEIvTEpD5LIpAfav2eeVO9HBTjvKHVJPRSs=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508= google.golang.org/appengine v1.4.0 h1:/wp5JvzpHIxhs/dumFmF7BXTf3Z+dd4uXta4kVyO508=
@ -400,6 +410,8 @@ google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoA
google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc=
google.golang.org/genproto v0.0.0-20200313141609-30c55424f95d h1:pyQjO6BnPvrPMldYxgDlXq9PLahtc0EKnUTYX1pWwXU= google.golang.org/genproto v0.0.0-20200313141609-30c55424f95d h1:pyQjO6BnPvrPMldYxgDlXq9PLahtc0EKnUTYX1pWwXU=
google.golang.org/genproto v0.0.0-20200313141609-30c55424f95d/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200313141609-30c55424f95d/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c=
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 h1:+kGHl1aib/qcwaRi1CbqBZ1rk19r85MNUf8HaBghugY=
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
@ -408,6 +420,15 @@ google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQ
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
google.golang.org/grpc v1.28.0 h1:bO/TA4OxCOummhSf10siHuG7vJOiwh7SpRpFZDkOgl4= google.golang.org/grpc v1.28.0 h1:bO/TA4OxCOummhSf10siHuG7vJOiwh7SpRpFZDkOgl4=
google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60= google.golang.org/grpc v1.28.0/go.mod h1:rpkK4SK4GF4Ach/+MFLZUBavHOvF2JJB5uozKKal+60=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE=
google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo=
google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU=
google.golang.org/protobuf v1.25.0 h1:Ejskq+SyPohKW+1uil0JJMtmHCgJPJ/qWTxr8qp+R4c=
google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY=

View File

@ -48,8 +48,8 @@ func GetAndroidNotification(req PushNotification) *fcm.Message {
notification.RegistrationIDs = req.Tokens notification.RegistrationIDs = req.Tokens
} }
if len(req.Priority) > 0 && req.Priority == "high" { if req.Priority == "high" || req.Priority == "normal" {
notification.Priority = "high" notification.Priority = req.Priority
} }
// Add another field // Add another field

View File

@ -30,6 +30,7 @@ func main() {
Badge: 1, Badge: 1,
Category: "test", Category: "test",
Sound: "test", Sound: "test",
Priority: proto.Priority_High,
Alert: &proto.Alert{ Alert: &proto.Alert{
Title: "Test Title", Title: "Test Title",
Body: "Test Alert Body", Body: "Test Alert Body",

View File

@ -1,3 +1,4 @@
// source: gorush.proto
/** /**
* @fileoverview * @fileoverview
* @enhanceable * @enhanceable
@ -12,13 +13,14 @@ var goog = jspb;
var global = Function('return this')(); var global = Function('return this')();
var google_protobuf_struct_pb = require('google-protobuf/google/protobuf/struct_pb.js'); var google_protobuf_struct_pb = require('google-protobuf/google/protobuf/struct_pb.js');
goog.object.extend(proto, google_protobuf_struct_pb);
goog.exportSymbol('proto.proto.Alert', null, global); goog.exportSymbol('proto.proto.Alert', null, global);
goog.exportSymbol('proto.proto.HealthCheckRequest', null, global); goog.exportSymbol('proto.proto.HealthCheckRequest', null, global);
goog.exportSymbol('proto.proto.HealthCheckResponse', null, global); goog.exportSymbol('proto.proto.HealthCheckResponse', null, global);
goog.exportSymbol('proto.proto.HealthCheckResponse.ServingStatus', null, global); goog.exportSymbol('proto.proto.HealthCheckResponse.ServingStatus', null, global);
goog.exportSymbol('proto.proto.NotificationReply', null, global); goog.exportSymbol('proto.proto.NotificationReply', null, global);
goog.exportSymbol('proto.proto.NotificationRequest', null, global); goog.exportSymbol('proto.proto.NotificationRequest', null, global);
goog.exportSymbol('proto.proto.Priority', null, global);
/** /**
* Generated by JsPbCodeGenerator. * Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a * @param {Array=} opt_data Optional initial data array, typically from a
@ -34,8 +36,97 @@ proto.proto.Alert = function(opt_data) {
}; };
goog.inherits(proto.proto.Alert, jspb.Message); goog.inherits(proto.proto.Alert, jspb.Message);
if (goog.DEBUG && !COMPILED) { if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.proto.Alert.displayName = 'proto.proto.Alert'; proto.proto.Alert.displayName = 'proto.proto.Alert';
} }
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.proto.NotificationRequest = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, proto.proto.NotificationRequest.repeatedFields_, null);
};
goog.inherits(proto.proto.NotificationRequest, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.proto.NotificationRequest.displayName = 'proto.proto.NotificationRequest';
}
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.proto.NotificationReply = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.proto.NotificationReply, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.proto.NotificationReply.displayName = 'proto.proto.NotificationReply';
}
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.proto.HealthCheckRequest = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.proto.HealthCheckRequest, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.proto.HealthCheckRequest.displayName = 'proto.proto.HealthCheckRequest';
}
/**
* Generated by JsPbCodeGenerator.
* @param {Array=} opt_data Optional initial data array, typically from a
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/
proto.proto.HealthCheckResponse = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
};
goog.inherits(proto.proto.HealthCheckResponse, jspb.Message);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
proto.proto.HealthCheckResponse.displayName = 'proto.proto.HealthCheckResponse';
}
/** /**
* List of repeated fields within this message type. * List of repeated fields within this message type.
* @private {!Array<number>} * @private {!Array<number>}
@ -47,13 +138,15 @@ proto.proto.Alert.repeatedFields_ = [9,10];
if (jspb.Message.GENERATE_TO_OBJECT) { if (jspb.Message.GENERATE_TO_OBJECT) {
/** /**
* Creates an object representation of this proto suitable for use in Soy templates. * Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name. * Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see: * For the list of reserved names please see:
* com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Whether to include the JSPB instance * @param {boolean=} opt_includeInstance Deprecated. whether to include the
* for transitional soy proto support: http://goto/soy-param-migration * JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object} * @return {!Object}
*/ */
proto.proto.Alert.prototype.toObject = function(opt_includeInstance) { proto.proto.Alert.prototype.toObject = function(opt_includeInstance) {
@ -63,8 +156,8 @@ proto.proto.Alert.prototype.toObject = function(opt_includeInstance) {
/** /**
* Static version of the {@see toObject} method. * Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Whether to include the JSPB * @param {boolean|undefined} includeInstance Deprecated. Whether to include
* instance for transitional soy proto support: * the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration * http://goto/soy-param-migration
* @param {!proto.proto.Alert} msg The msg instance to transform. * @param {!proto.proto.Alert} msg The msg instance to transform.
* @return {!Object} * @return {!Object}
@ -80,8 +173,8 @@ proto.proto.Alert.toObject = function(includeInstance, msg) {
launchimage: jspb.Message.getFieldWithDefault(msg, 6, ""), launchimage: jspb.Message.getFieldWithDefault(msg, 6, ""),
lockey: jspb.Message.getFieldWithDefault(msg, 7, ""), lockey: jspb.Message.getFieldWithDefault(msg, 7, ""),
titlelockey: jspb.Message.getFieldWithDefault(msg, 8, ""), titlelockey: jspb.Message.getFieldWithDefault(msg, 8, ""),
locargsList: jspb.Message.getRepeatedField(msg, 9), locargsList: (f = jspb.Message.getRepeatedField(msg, 9)) == null ? undefined : f,
titlelocargsList: jspb.Message.getRepeatedField(msg, 10) titlelocargsList: (f = jspb.Message.getRepeatedField(msg, 10)) == null ? undefined : f
}; };
if (includeInstance) { if (includeInstance) {
@ -269,9 +362,12 @@ proto.proto.Alert.prototype.getTitle = function() {
}; };
/** @param {string} value */ /**
* @param {string} value
* @return {!proto.proto.Alert} returns this
*/
proto.proto.Alert.prototype.setTitle = function(value) { proto.proto.Alert.prototype.setTitle = function(value) {
jspb.Message.setProto3StringField(this, 1, value); return jspb.Message.setProto3StringField(this, 1, value);
}; };
@ -284,9 +380,12 @@ proto.proto.Alert.prototype.getBody = function() {
}; };
/** @param {string} value */ /**
* @param {string} value
* @return {!proto.proto.Alert} returns this
*/
proto.proto.Alert.prototype.setBody = function(value) { proto.proto.Alert.prototype.setBody = function(value) {
jspb.Message.setProto3StringField(this, 2, value); return jspb.Message.setProto3StringField(this, 2, value);
}; };
@ -299,9 +398,12 @@ proto.proto.Alert.prototype.getSubtitle = function() {
}; };
/** @param {string} value */ /**
* @param {string} value
* @return {!proto.proto.Alert} returns this
*/
proto.proto.Alert.prototype.setSubtitle = function(value) { proto.proto.Alert.prototype.setSubtitle = function(value) {
jspb.Message.setProto3StringField(this, 3, value); return jspb.Message.setProto3StringField(this, 3, value);
}; };
@ -314,9 +416,12 @@ proto.proto.Alert.prototype.getAction = function() {
}; };
/** @param {string} value */ /**
* @param {string} value
* @return {!proto.proto.Alert} returns this
*/
proto.proto.Alert.prototype.setAction = function(value) { proto.proto.Alert.prototype.setAction = function(value) {
jspb.Message.setProto3StringField(this, 4, value); return jspb.Message.setProto3StringField(this, 4, value);
}; };
@ -329,9 +434,12 @@ proto.proto.Alert.prototype.getActionlockey = function() {
}; };
/** @param {string} value */ /**
* @param {string} value
* @return {!proto.proto.Alert} returns this
*/
proto.proto.Alert.prototype.setActionlockey = function(value) { proto.proto.Alert.prototype.setActionlockey = function(value) {
jspb.Message.setProto3StringField(this, 5, value); return jspb.Message.setProto3StringField(this, 5, value);
}; };
@ -344,9 +452,12 @@ proto.proto.Alert.prototype.getLaunchimage = function() {
}; };
/** @param {string} value */ /**
* @param {string} value
* @return {!proto.proto.Alert} returns this
*/
proto.proto.Alert.prototype.setLaunchimage = function(value) { proto.proto.Alert.prototype.setLaunchimage = function(value) {
jspb.Message.setProto3StringField(this, 6, value); return jspb.Message.setProto3StringField(this, 6, value);
}; };
@ -359,9 +470,12 @@ proto.proto.Alert.prototype.getLockey = function() {
}; };
/** @param {string} value */ /**
* @param {string} value
* @return {!proto.proto.Alert} returns this
*/
proto.proto.Alert.prototype.setLockey = function(value) { proto.proto.Alert.prototype.setLockey = function(value) {
jspb.Message.setProto3StringField(this, 7, value); return jspb.Message.setProto3StringField(this, 7, value);
}; };
@ -374,9 +488,12 @@ proto.proto.Alert.prototype.getTitlelockey = function() {
}; };
/** @param {string} value */ /**
* @param {string} value
* @return {!proto.proto.Alert} returns this
*/
proto.proto.Alert.prototype.setTitlelockey = function(value) { proto.proto.Alert.prototype.setTitlelockey = function(value) {
jspb.Message.setProto3StringField(this, 8, value); return jspb.Message.setProto3StringField(this, 8, value);
}; };
@ -389,23 +506,31 @@ proto.proto.Alert.prototype.getLocargsList = function() {
}; };
/** @param {!Array<string>} value */ /**
* @param {!Array<string>} value
* @return {!proto.proto.Alert} returns this
*/
proto.proto.Alert.prototype.setLocargsList = function(value) { proto.proto.Alert.prototype.setLocargsList = function(value) {
jspb.Message.setField(this, 9, value || []); return jspb.Message.setField(this, 9, value || []);
}; };
/** /**
* @param {!string} value * @param {string} value
* @param {number=} opt_index * @param {number=} opt_index
* @return {!proto.proto.Alert} returns this
*/ */
proto.proto.Alert.prototype.addLocargs = function(value, opt_index) { proto.proto.Alert.prototype.addLocargs = function(value, opt_index) {
jspb.Message.addToRepeatedField(this, 9, value, opt_index); return jspb.Message.addToRepeatedField(this, 9, value, opt_index);
}; };
/**
* Clears the list making it empty but non-null.
* @return {!proto.proto.Alert} returns this
*/
proto.proto.Alert.prototype.clearLocargsList = function() { proto.proto.Alert.prototype.clearLocargsList = function() {
this.setLocargsList([]); return this.setLocargsList([]);
}; };
@ -418,44 +543,35 @@ proto.proto.Alert.prototype.getTitlelocargsList = function() {
}; };
/** @param {!Array<string>} value */ /**
* @param {!Array<string>} value
* @return {!proto.proto.Alert} returns this
*/
proto.proto.Alert.prototype.setTitlelocargsList = function(value) { proto.proto.Alert.prototype.setTitlelocargsList = function(value) {
jspb.Message.setField(this, 10, value || []); return jspb.Message.setField(this, 10, value || []);
}; };
/** /**
* @param {!string} value * @param {string} value
* @param {number=} opt_index * @param {number=} opt_index
* @return {!proto.proto.Alert} returns this
*/ */
proto.proto.Alert.prototype.addTitlelocargs = function(value, opt_index) { proto.proto.Alert.prototype.addTitlelocargs = function(value, opt_index) {
jspb.Message.addToRepeatedField(this, 10, value, opt_index); return jspb.Message.addToRepeatedField(this, 10, value, opt_index);
}; };
proto.proto.Alert.prototype.clearTitlelocargsList = function() {
this.setTitlelocargsList([]);
};
/** /**
* Generated by JsPbCodeGenerator. * Clears the list making it empty but non-null.
* @param {Array=} opt_data Optional initial data array, typically from a * @return {!proto.proto.Alert} returns this
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/ */
proto.proto.NotificationRequest = function(opt_data) { proto.proto.Alert.prototype.clearTitlelocargsList = function() {
jspb.Message.initialize(this, opt_data, 0, -1, proto.proto.NotificationRequest.repeatedFields_, null); return this.setTitlelocargsList([]);
}; };
goog.inherits(proto.proto.NotificationRequest, jspb.Message);
if (goog.DEBUG && !COMPILED) {
proto.proto.NotificationRequest.displayName = 'proto.proto.NotificationRequest';
}
/** /**
* List of repeated fields within this message type. * List of repeated fields within this message type.
* @private {!Array<number>} * @private {!Array<number>}
@ -467,13 +583,15 @@ proto.proto.NotificationRequest.repeatedFields_ = [1];
if (jspb.Message.GENERATE_TO_OBJECT) { if (jspb.Message.GENERATE_TO_OBJECT) {
/** /**
* Creates an object representation of this proto suitable for use in Soy templates. * Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name. * Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see: * For the list of reserved names please see:
* com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Whether to include the JSPB instance * @param {boolean=} opt_includeInstance Deprecated. whether to include the
* for transitional soy proto support: http://goto/soy-param-migration * JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object} * @return {!Object}
*/ */
proto.proto.NotificationRequest.prototype.toObject = function(opt_includeInstance) { proto.proto.NotificationRequest.prototype.toObject = function(opt_includeInstance) {
@ -483,8 +601,8 @@ proto.proto.NotificationRequest.prototype.toObject = function(opt_includeInstanc
/** /**
* Static version of the {@see toObject} method. * Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Whether to include the JSPB * @param {boolean|undefined} includeInstance Deprecated. Whether to include
* instance for transitional soy proto support: * the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration * http://goto/soy-param-migration
* @param {!proto.proto.NotificationRequest} msg The msg instance to transform. * @param {!proto.proto.NotificationRequest} msg The msg instance to transform.
* @return {!Object} * @return {!Object}
@ -492,7 +610,7 @@ proto.proto.NotificationRequest.prototype.toObject = function(opt_includeInstanc
*/ */
proto.proto.NotificationRequest.toObject = function(includeInstance, msg) { proto.proto.NotificationRequest.toObject = function(includeInstance, msg) {
var f, obj = { var f, obj = {
tokensList: jspb.Message.getRepeatedField(msg, 1), tokensList: (f = jspb.Message.getRepeatedField(msg, 1)) == null ? undefined : f,
platform: jspb.Message.getFieldWithDefault(msg, 2, 0), platform: jspb.Message.getFieldWithDefault(msg, 2, 0),
message: jspb.Message.getFieldWithDefault(msg, 3, ""), message: jspb.Message.getFieldWithDefault(msg, 3, ""),
title: jspb.Message.getFieldWithDefault(msg, 4, ""), title: jspb.Message.getFieldWithDefault(msg, 4, ""),
@ -502,11 +620,12 @@ proto.proto.NotificationRequest.toObject = function(includeInstance, msg) {
category: jspb.Message.getFieldWithDefault(msg, 8, ""), category: jspb.Message.getFieldWithDefault(msg, 8, ""),
alert: (f = msg.getAlert()) && proto.proto.Alert.toObject(includeInstance, f), alert: (f = msg.getAlert()) && proto.proto.Alert.toObject(includeInstance, f),
sound: jspb.Message.getFieldWithDefault(msg, 10, ""), sound: jspb.Message.getFieldWithDefault(msg, 10, ""),
contentavailable: jspb.Message.getFieldWithDefault(msg, 11, false), contentavailable: jspb.Message.getBooleanFieldWithDefault(msg, 11, false),
threadid: jspb.Message.getFieldWithDefault(msg, 12, ""), threadid: jspb.Message.getFieldWithDefault(msg, 12, ""),
mutablecontent: jspb.Message.getFieldWithDefault(msg, 13, false), mutablecontent: jspb.Message.getBooleanFieldWithDefault(msg, 13, false),
data: (f = msg.getData()) && google_protobuf_struct_pb.Struct.toObject(includeInstance, f), data: (f = msg.getData()) && google_protobuf_struct_pb.Struct.toObject(includeInstance, f),
image: jspb.Message.getFieldWithDefault(msg, 15, "") image: jspb.Message.getFieldWithDefault(msg, 15, ""),
priority: jspb.Message.getFieldWithDefault(msg, 16, 0)
}; };
if (includeInstance) { if (includeInstance) {
@ -605,6 +724,10 @@ proto.proto.NotificationRequest.deserializeBinaryFromReader = function(msg, read
var value = /** @type {string} */ (reader.readString()); var value = /** @type {string} */ (reader.readString());
msg.setImage(value); msg.setImage(value);
break; break;
case 16:
var value = /** @type {!proto.proto.Priority} */ (reader.readEnum());
msg.setPriority(value);
break;
default: default:
reader.skipField(); reader.skipField();
break; break;
@ -741,6 +864,13 @@ proto.proto.NotificationRequest.serializeBinaryToWriter = function(message, writ
f f
); );
} }
f = message.getPriority();
if (f !== 0.0) {
writer.writeEnum(
16,
f
);
}
}; };
@ -753,23 +883,31 @@ proto.proto.NotificationRequest.prototype.getTokensList = function() {
}; };
/** @param {!Array<string>} value */ /**
* @param {!Array<string>} value
* @return {!proto.proto.NotificationRequest} returns this
*/
proto.proto.NotificationRequest.prototype.setTokensList = function(value) { proto.proto.NotificationRequest.prototype.setTokensList = function(value) {
jspb.Message.setField(this, 1, value || []); return jspb.Message.setField(this, 1, value || []);
}; };
/** /**
* @param {!string} value * @param {string} value
* @param {number=} opt_index * @param {number=} opt_index
* @return {!proto.proto.NotificationRequest} returns this
*/ */
proto.proto.NotificationRequest.prototype.addTokens = function(value, opt_index) { proto.proto.NotificationRequest.prototype.addTokens = function(value, opt_index) {
jspb.Message.addToRepeatedField(this, 1, value, opt_index); return jspb.Message.addToRepeatedField(this, 1, value, opt_index);
}; };
/**
* Clears the list making it empty but non-null.
* @return {!proto.proto.NotificationRequest} returns this
*/
proto.proto.NotificationRequest.prototype.clearTokensList = function() { proto.proto.NotificationRequest.prototype.clearTokensList = function() {
this.setTokensList([]); return this.setTokensList([]);
}; };
@ -782,9 +920,12 @@ proto.proto.NotificationRequest.prototype.getPlatform = function() {
}; };
/** @param {number} value */ /**
* @param {number} value
* @return {!proto.proto.NotificationRequest} returns this
*/
proto.proto.NotificationRequest.prototype.setPlatform = function(value) { proto.proto.NotificationRequest.prototype.setPlatform = function(value) {
jspb.Message.setProto3IntField(this, 2, value); return jspb.Message.setProto3IntField(this, 2, value);
}; };
@ -797,9 +938,12 @@ proto.proto.NotificationRequest.prototype.getMessage = function() {
}; };
/** @param {string} value */ /**
* @param {string} value
* @return {!proto.proto.NotificationRequest} returns this
*/
proto.proto.NotificationRequest.prototype.setMessage = function(value) { proto.proto.NotificationRequest.prototype.setMessage = function(value) {
jspb.Message.setProto3StringField(this, 3, value); return jspb.Message.setProto3StringField(this, 3, value);
}; };
@ -812,9 +956,12 @@ proto.proto.NotificationRequest.prototype.getTitle = function() {
}; };
/** @param {string} value */ /**
* @param {string} value
* @return {!proto.proto.NotificationRequest} returns this
*/
proto.proto.NotificationRequest.prototype.setTitle = function(value) { proto.proto.NotificationRequest.prototype.setTitle = function(value) {
jspb.Message.setProto3StringField(this, 4, value); return jspb.Message.setProto3StringField(this, 4, value);
}; };
@ -827,9 +974,12 @@ proto.proto.NotificationRequest.prototype.getTopic = function() {
}; };
/** @param {string} value */ /**
* @param {string} value
* @return {!proto.proto.NotificationRequest} returns this
*/
proto.proto.NotificationRequest.prototype.setTopic = function(value) { proto.proto.NotificationRequest.prototype.setTopic = function(value) {
jspb.Message.setProto3StringField(this, 5, value); return jspb.Message.setProto3StringField(this, 5, value);
}; };
@ -842,9 +992,12 @@ proto.proto.NotificationRequest.prototype.getKey = function() {
}; };
/** @param {string} value */ /**
* @param {string} value
* @return {!proto.proto.NotificationRequest} returns this
*/
proto.proto.NotificationRequest.prototype.setKey = function(value) { proto.proto.NotificationRequest.prototype.setKey = function(value) {
jspb.Message.setProto3StringField(this, 6, value); return jspb.Message.setProto3StringField(this, 6, value);
}; };
@ -857,9 +1010,12 @@ proto.proto.NotificationRequest.prototype.getBadge = function() {
}; };
/** @param {number} value */ /**
* @param {number} value
* @return {!proto.proto.NotificationRequest} returns this
*/
proto.proto.NotificationRequest.prototype.setBadge = function(value) { proto.proto.NotificationRequest.prototype.setBadge = function(value) {
jspb.Message.setProto3IntField(this, 7, value); return jspb.Message.setProto3IntField(this, 7, value);
}; };
@ -872,9 +1028,12 @@ proto.proto.NotificationRequest.prototype.getCategory = function() {
}; };
/** @param {string} value */ /**
* @param {string} value
* @return {!proto.proto.NotificationRequest} returns this
*/
proto.proto.NotificationRequest.prototype.setCategory = function(value) { proto.proto.NotificationRequest.prototype.setCategory = function(value) {
jspb.Message.setProto3StringField(this, 8, value); return jspb.Message.setProto3StringField(this, 8, value);
}; };
@ -888,20 +1047,27 @@ proto.proto.NotificationRequest.prototype.getAlert = function() {
}; };
/** @param {?proto.proto.Alert|undefined} value */ /**
* @param {?proto.proto.Alert|undefined} value
* @return {!proto.proto.NotificationRequest} returns this
*/
proto.proto.NotificationRequest.prototype.setAlert = function(value) { proto.proto.NotificationRequest.prototype.setAlert = function(value) {
jspb.Message.setWrapperField(this, 9, value); return jspb.Message.setWrapperField(this, 9, value);
}; };
/**
* Clears the message field making it undefined.
* @return {!proto.proto.NotificationRequest} returns this
*/
proto.proto.NotificationRequest.prototype.clearAlert = function() { proto.proto.NotificationRequest.prototype.clearAlert = function() {
this.setAlert(undefined); return this.setAlert(undefined);
}; };
/** /**
* Returns whether this field is set. * Returns whether this field is set.
* @return {!boolean} * @return {boolean}
*/ */
proto.proto.NotificationRequest.prototype.hasAlert = function() { proto.proto.NotificationRequest.prototype.hasAlert = function() {
return jspb.Message.getField(this, 9) != null; return jspb.Message.getField(this, 9) != null;
@ -917,26 +1083,30 @@ proto.proto.NotificationRequest.prototype.getSound = function() {
}; };
/** @param {string} value */ /**
* @param {string} value
* @return {!proto.proto.NotificationRequest} returns this
*/
proto.proto.NotificationRequest.prototype.setSound = function(value) { proto.proto.NotificationRequest.prototype.setSound = function(value) {
jspb.Message.setProto3StringField(this, 10, value); return jspb.Message.setProto3StringField(this, 10, value);
}; };
/** /**
* optional bool contentAvailable = 11; * optional bool contentAvailable = 11;
* Note that Boolean fields may be set to 0/1 when serialized from a Java server.
* You should avoid comparisons like {@code val === true/false} in those cases.
* @return {boolean} * @return {boolean}
*/ */
proto.proto.NotificationRequest.prototype.getContentavailable = function() { proto.proto.NotificationRequest.prototype.getContentavailable = function() {
return /** @type {boolean} */ (jspb.Message.getFieldWithDefault(this, 11, false)); return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 11, false));
}; };
/** @param {boolean} value */ /**
* @param {boolean} value
* @return {!proto.proto.NotificationRequest} returns this
*/
proto.proto.NotificationRequest.prototype.setContentavailable = function(value) { proto.proto.NotificationRequest.prototype.setContentavailable = function(value) {
jspb.Message.setProto3BooleanField(this, 11, value); return jspb.Message.setProto3BooleanField(this, 11, value);
}; };
@ -949,26 +1119,30 @@ proto.proto.NotificationRequest.prototype.getThreadid = function() {
}; };
/** @param {string} value */ /**
* @param {string} value
* @return {!proto.proto.NotificationRequest} returns this
*/
proto.proto.NotificationRequest.prototype.setThreadid = function(value) { proto.proto.NotificationRequest.prototype.setThreadid = function(value) {
jspb.Message.setProto3StringField(this, 12, value); return jspb.Message.setProto3StringField(this, 12, value);
}; };
/** /**
* optional bool mutableContent = 13; * optional bool mutableContent = 13;
* Note that Boolean fields may be set to 0/1 when serialized from a Java server.
* You should avoid comparisons like {@code val === true/false} in those cases.
* @return {boolean} * @return {boolean}
*/ */
proto.proto.NotificationRequest.prototype.getMutablecontent = function() { proto.proto.NotificationRequest.prototype.getMutablecontent = function() {
return /** @type {boolean} */ (jspb.Message.getFieldWithDefault(this, 13, false)); return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 13, false));
}; };
/** @param {boolean} value */ /**
* @param {boolean} value
* @return {!proto.proto.NotificationRequest} returns this
*/
proto.proto.NotificationRequest.prototype.setMutablecontent = function(value) { proto.proto.NotificationRequest.prototype.setMutablecontent = function(value) {
jspb.Message.setProto3BooleanField(this, 13, value); return jspb.Message.setProto3BooleanField(this, 13, value);
}; };
@ -982,20 +1156,27 @@ proto.proto.NotificationRequest.prototype.getData = function() {
}; };
/** @param {?proto.google.protobuf.Struct|undefined} value */ /**
* @param {?proto.google.protobuf.Struct|undefined} value
* @return {!proto.proto.NotificationRequest} returns this
*/
proto.proto.NotificationRequest.prototype.setData = function(value) { proto.proto.NotificationRequest.prototype.setData = function(value) {
jspb.Message.setWrapperField(this, 14, value); return jspb.Message.setWrapperField(this, 14, value);
}; };
/**
* Clears the message field making it undefined.
* @return {!proto.proto.NotificationRequest} returns this
*/
proto.proto.NotificationRequest.prototype.clearData = function() { proto.proto.NotificationRequest.prototype.clearData = function() {
this.setData(undefined); return this.setData(undefined);
}; };
/** /**
* Returns whether this field is set. * Returns whether this field is set.
* @return {!boolean} * @return {boolean}
*/ */
proto.proto.NotificationRequest.prototype.hasData = function() { proto.proto.NotificationRequest.prototype.hasData = function() {
return jspb.Message.getField(this, 14) != null; return jspb.Message.getField(this, 14) != null;
@ -1011,41 +1192,47 @@ proto.proto.NotificationRequest.prototype.getImage = function() {
}; };
/** @param {string} value */ /**
* @param {string} value
* @return {!proto.proto.NotificationRequest} returns this
*/
proto.proto.NotificationRequest.prototype.setImage = function(value) { proto.proto.NotificationRequest.prototype.setImage = function(value) {
jspb.Message.setProto3StringField(this, 15, value); return jspb.Message.setProto3StringField(this, 15, value);
}; };
/** /**
* Generated by JsPbCodeGenerator. * optional Priority Priority = 16;
* @param {Array=} opt_data Optional initial data array, typically from a * @return {!proto.proto.Priority}
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/ */
proto.proto.NotificationReply = function(opt_data) { proto.proto.NotificationRequest.prototype.getPriority = function() {
jspb.Message.initialize(this, opt_data, 0, -1, null, null); return /** @type {!proto.proto.Priority} */ (jspb.Message.getFieldWithDefault(this, 16, 0));
}; };
goog.inherits(proto.proto.NotificationReply, jspb.Message);
if (goog.DEBUG && !COMPILED) {
proto.proto.NotificationReply.displayName = 'proto.proto.NotificationReply'; /**
} * @param {!proto.proto.Priority} value
* @return {!proto.proto.NotificationRequest} returns this
*/
proto.proto.NotificationRequest.prototype.setPriority = function(value) {
return jspb.Message.setProto3EnumField(this, 16, value);
};
if (jspb.Message.GENERATE_TO_OBJECT) { if (jspb.Message.GENERATE_TO_OBJECT) {
/** /**
* Creates an object representation of this proto suitable for use in Soy templates. * Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name. * Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see: * For the list of reserved names please see:
* com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Whether to include the JSPB instance * @param {boolean=} opt_includeInstance Deprecated. whether to include the
* for transitional soy proto support: http://goto/soy-param-migration * JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object} * @return {!Object}
*/ */
proto.proto.NotificationReply.prototype.toObject = function(opt_includeInstance) { proto.proto.NotificationReply.prototype.toObject = function(opt_includeInstance) {
@ -1055,8 +1242,8 @@ proto.proto.NotificationReply.prototype.toObject = function(opt_includeInstance)
/** /**
* Static version of the {@see toObject} method. * Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Whether to include the JSPB * @param {boolean|undefined} includeInstance Deprecated. Whether to include
* instance for transitional soy proto support: * the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration * http://goto/soy-param-migration
* @param {!proto.proto.NotificationReply} msg The msg instance to transform. * @param {!proto.proto.NotificationReply} msg The msg instance to transform.
* @return {!Object} * @return {!Object}
@ -1064,7 +1251,7 @@ proto.proto.NotificationReply.prototype.toObject = function(opt_includeInstance)
*/ */
proto.proto.NotificationReply.toObject = function(includeInstance, msg) { proto.proto.NotificationReply.toObject = function(includeInstance, msg) {
var f, obj = { var f, obj = {
success: jspb.Message.getFieldWithDefault(msg, 1, false), success: jspb.Message.getBooleanFieldWithDefault(msg, 1, false),
counts: jspb.Message.getFieldWithDefault(msg, 2, 0) counts: jspb.Message.getFieldWithDefault(msg, 2, 0)
}; };
@ -1158,18 +1345,19 @@ proto.proto.NotificationReply.serializeBinaryToWriter = function(message, writer
/** /**
* optional bool success = 1; * optional bool success = 1;
* Note that Boolean fields may be set to 0/1 when serialized from a Java server.
* You should avoid comparisons like {@code val === true/false} in those cases.
* @return {boolean} * @return {boolean}
*/ */
proto.proto.NotificationReply.prototype.getSuccess = function() { proto.proto.NotificationReply.prototype.getSuccess = function() {
return /** @type {boolean} */ (jspb.Message.getFieldWithDefault(this, 1, false)); return /** @type {boolean} */ (jspb.Message.getBooleanFieldWithDefault(this, 1, false));
}; };
/** @param {boolean} value */ /**
* @param {boolean} value
* @return {!proto.proto.NotificationReply} returns this
*/
proto.proto.NotificationReply.prototype.setSuccess = function(value) { proto.proto.NotificationReply.prototype.setSuccess = function(value) {
jspb.Message.setProto3BooleanField(this, 1, value); return jspb.Message.setProto3BooleanField(this, 1, value);
}; };
@ -1182,41 +1370,29 @@ proto.proto.NotificationReply.prototype.getCounts = function() {
}; };
/** @param {number} value */
proto.proto.NotificationReply.prototype.setCounts = function(value) {
jspb.Message.setProto3IntField(this, 2, value);
};
/** /**
* Generated by JsPbCodeGenerator. * @param {number} value
* @param {Array=} opt_data Optional initial data array, typically from a * @return {!proto.proto.NotificationReply} returns this
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/ */
proto.proto.HealthCheckRequest = function(opt_data) { proto.proto.NotificationReply.prototype.setCounts = function(value) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null); return jspb.Message.setProto3IntField(this, 2, value);
}; };
goog.inherits(proto.proto.HealthCheckRequest, jspb.Message);
if (goog.DEBUG && !COMPILED) {
proto.proto.HealthCheckRequest.displayName = 'proto.proto.HealthCheckRequest';
}
if (jspb.Message.GENERATE_TO_OBJECT) { if (jspb.Message.GENERATE_TO_OBJECT) {
/** /**
* Creates an object representation of this proto suitable for use in Soy templates. * Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name. * Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see: * For the list of reserved names please see:
* com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Whether to include the JSPB instance * @param {boolean=} opt_includeInstance Deprecated. whether to include the
* for transitional soy proto support: http://goto/soy-param-migration * JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object} * @return {!Object}
*/ */
proto.proto.HealthCheckRequest.prototype.toObject = function(opt_includeInstance) { proto.proto.HealthCheckRequest.prototype.toObject = function(opt_includeInstance) {
@ -1226,8 +1402,8 @@ proto.proto.HealthCheckRequest.prototype.toObject = function(opt_includeInstance
/** /**
* Static version of the {@see toObject} method. * Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Whether to include the JSPB * @param {boolean|undefined} includeInstance Deprecated. Whether to include
* instance for transitional soy proto support: * the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration * http://goto/soy-param-migration
* @param {!proto.proto.HealthCheckRequest} msg The msg instance to transform. * @param {!proto.proto.HealthCheckRequest} msg The msg instance to transform.
* @return {!Object} * @return {!Object}
@ -1324,41 +1500,29 @@ proto.proto.HealthCheckRequest.prototype.getService = function() {
}; };
/** @param {string} value */
proto.proto.HealthCheckRequest.prototype.setService = function(value) {
jspb.Message.setProto3StringField(this, 1, value);
};
/** /**
* Generated by JsPbCodeGenerator. * @param {string} value
* @param {Array=} opt_data Optional initial data array, typically from a * @return {!proto.proto.HealthCheckRequest} returns this
* server response, or constructed directly in Javascript. The array is used
* in place and becomes part of the constructed object. It is not cloned.
* If no data is provided, the constructed object will be empty, but still
* valid.
* @extends {jspb.Message}
* @constructor
*/ */
proto.proto.HealthCheckResponse = function(opt_data) { proto.proto.HealthCheckRequest.prototype.setService = function(value) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null); return jspb.Message.setProto3StringField(this, 1, value);
}; };
goog.inherits(proto.proto.HealthCheckResponse, jspb.Message);
if (goog.DEBUG && !COMPILED) {
proto.proto.HealthCheckResponse.displayName = 'proto.proto.HealthCheckResponse';
}
if (jspb.Message.GENERATE_TO_OBJECT) { if (jspb.Message.GENERATE_TO_OBJECT) {
/** /**
* Creates an object representation of this proto suitable for use in Soy templates. * Creates an object representation of this proto.
* Field names that are reserved in JavaScript and will be renamed to pb_name. * Field names that are reserved in JavaScript and will be renamed to pb_name.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default. * To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see: * For the list of reserved names please see:
* com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS. * net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Whether to include the JSPB instance * @param {boolean=} opt_includeInstance Deprecated. whether to include the
* for transitional soy proto support: http://goto/soy-param-migration * JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object} * @return {!Object}
*/ */
proto.proto.HealthCheckResponse.prototype.toObject = function(opt_includeInstance) { proto.proto.HealthCheckResponse.prototype.toObject = function(opt_includeInstance) {
@ -1368,8 +1532,8 @@ proto.proto.HealthCheckResponse.prototype.toObject = function(opt_includeInstanc
/** /**
* Static version of the {@see toObject} method. * Static version of the {@see toObject} method.
* @param {boolean|undefined} includeInstance Whether to include the JSPB * @param {boolean|undefined} includeInstance Deprecated. Whether to include
* instance for transitional soy proto support: * the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration * http://goto/soy-param-migration
* @param {!proto.proto.HealthCheckResponse} msg The msg instance to transform. * @param {!proto.proto.HealthCheckResponse} msg The msg instance to transform.
* @return {!Object} * @return {!Object}
@ -1475,10 +1639,21 @@ proto.proto.HealthCheckResponse.prototype.getStatus = function() {
}; };
/** @param {!proto.proto.HealthCheckResponse.ServingStatus} value */ /**
* @param {!proto.proto.HealthCheckResponse.ServingStatus} value
* @return {!proto.proto.HealthCheckResponse} returns this
*/
proto.proto.HealthCheckResponse.prototype.setStatus = function(value) { proto.proto.HealthCheckResponse.prototype.setStatus = function(value) {
jspb.Message.setProto3EnumField(this, 1, value); return jspb.Message.setProto3EnumField(this, 1, value);
}; };
/**
* @enum {number}
*/
proto.proto.Priority = {
NORMAL: 0,
HIGH: 1
};
goog.object.extend(exports, proto.proto); goog.object.extend(exports, proto.proto);

File diff suppressed because it is too large Load Diff

View File

@ -32,6 +32,11 @@ message NotificationRequest {
bool mutableContent = 13; bool mutableContent = 13;
google.protobuf.Struct data = 14; google.protobuf.Struct data = 14;
string image = 15; string image = 15;
enum Priority {
Normal = 0;
High = 1;
}
Priority Priority = 16;
} }
message NotificationReply { message NotificationReply {

View File

@ -3,6 +3,7 @@ package rpc
import ( import (
"context" "context"
"net" "net"
"strings"
"sync" "sync"
"github.com/appleboy/gorush/gorush" "github.com/appleboy/gorush/gorush"
@ -62,6 +63,7 @@ func (s *Server) Send(ctx context.Context, in *proto.NotificationRequest) (*prot
ThreadID: in.ThreadID, ThreadID: in.ThreadID,
MutableContent: in.MutableContent, MutableContent: in.MutableContent,
Image: in.Image, Image: in.Image,
Priority: strings.ToLower(in.GetPriority().String()),
} }
if badge > 0 { if badge > 0 {