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

View File

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

View File

@@ -1,3 +1,4 @@
// source: gorush.proto
/**
* @fileoverview
* @enhanceable
@@ -12,13 +13,14 @@ var goog = jspb;
var global = Function('return this')();
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.HealthCheckRequest', null, global);
goog.exportSymbol('proto.proto.HealthCheckResponse', null, global);
goog.exportSymbol('proto.proto.HealthCheckResponse.ServingStatus', null, global);
goog.exportSymbol('proto.proto.NotificationReply', null, global);
goog.exportSymbol('proto.proto.NotificationRequest', null, global);
goog.exportSymbol('proto.proto.Priority', null, global);
/**
* Generated by JsPbCodeGenerator.
* @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);
if (goog.DEBUG && !COMPILED) {
/**
* @public
* @override
*/
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.
* @private {!Array<number>}
@@ -47,13 +138,15 @@ proto.proto.Alert.repeatedFields_ = [9,10];
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.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS.
* @param {boolean=} opt_includeInstance Whether to include the JSPB instance
* for transitional soy proto support: http://goto/soy-param-migration
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
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.
* @param {boolean|undefined} includeInstance Whether to include the JSPB
* instance for transitional soy proto support:
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.proto.Alert} msg The msg instance to transform.
* @return {!Object}
@@ -80,8 +173,8 @@ proto.proto.Alert.toObject = function(includeInstance, msg) {
launchimage: jspb.Message.getFieldWithDefault(msg, 6, ""),
lockey: jspb.Message.getFieldWithDefault(msg, 7, ""),
titlelockey: jspb.Message.getFieldWithDefault(msg, 8, ""),
locargsList: jspb.Message.getRepeatedField(msg, 9),
titlelocargsList: jspb.Message.getRepeatedField(msg, 10)
locargsList: (f = jspb.Message.getRepeatedField(msg, 9)) == null ? undefined : f,
titlelocargsList: (f = jspb.Message.getRepeatedField(msg, 10)) == null ? undefined : f
};
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) {
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) {
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) {
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) {
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) {
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) {
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) {
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) {
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) {
jspb.Message.setField(this, 9, value || []);
return jspb.Message.setField(this, 9, value || []);
};
/**
* @param {!string} value
* @param {string} value
* @param {number=} opt_index
* @return {!proto.proto.Alert} returns this
*/
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() {
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) {
jspb.Message.setField(this, 10, value || []);
return jspb.Message.setField(this, 10, value || []);
};
/**
* @param {!string} value
* @param {string} value
* @param {number=} opt_index
* @return {!proto.proto.Alert} returns this
*/
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.
* @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
* Clears the list making it empty but non-null.
* @return {!proto.proto.Alert} returns this
*/
proto.proto.NotificationRequest = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, proto.proto.NotificationRequest.repeatedFields_, null);
proto.proto.Alert.prototype.clearTitlelocargsList = function() {
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.
* @private {!Array<number>}
@@ -467,13 +583,15 @@ proto.proto.NotificationRequest.repeatedFields_ = [1];
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.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS.
* @param {boolean=} opt_includeInstance Whether to include the JSPB instance
* for transitional soy proto support: http://goto/soy-param-migration
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
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.
* @param {boolean|undefined} includeInstance Whether to include the JSPB
* instance for transitional soy proto support:
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.proto.NotificationRequest} msg The msg instance to transform.
* @return {!Object}
@@ -492,7 +610,7 @@ proto.proto.NotificationRequest.prototype.toObject = function(opt_includeInstanc
*/
proto.proto.NotificationRequest.toObject = function(includeInstance, msg) {
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),
message: jspb.Message.getFieldWithDefault(msg, 3, ""),
title: jspb.Message.getFieldWithDefault(msg, 4, ""),
@@ -502,11 +620,12 @@ proto.proto.NotificationRequest.toObject = function(includeInstance, msg) {
category: jspb.Message.getFieldWithDefault(msg, 8, ""),
alert: (f = msg.getAlert()) && proto.proto.Alert.toObject(includeInstance, f),
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, ""),
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),
image: jspb.Message.getFieldWithDefault(msg, 15, "")
image: jspb.Message.getFieldWithDefault(msg, 15, ""),
priority: jspb.Message.getFieldWithDefault(msg, 16, 0)
};
if (includeInstance) {
@@ -605,6 +724,10 @@ proto.proto.NotificationRequest.deserializeBinaryFromReader = function(msg, read
var value = /** @type {string} */ (reader.readString());
msg.setImage(value);
break;
case 16:
var value = /** @type {!proto.proto.Priority} */ (reader.readEnum());
msg.setPriority(value);
break;
default:
reader.skipField();
break;
@@ -741,6 +864,13 @@ proto.proto.NotificationRequest.serializeBinaryToWriter = function(message, writ
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) {
jspb.Message.setField(this, 1, value || []);
return jspb.Message.setField(this, 1, value || []);
};
/**
* @param {!string} value
* @param {string} value
* @param {number=} opt_index
* @return {!proto.proto.NotificationRequest} returns this
*/
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() {
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) {
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) {
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) {
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) {
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) {
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) {
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) {
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) {
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() {
this.setAlert(undefined);
return this.setAlert(undefined);
};
/**
* Returns whether this field is set.
* @return {!boolean}
* @return {boolean}
*/
proto.proto.NotificationRequest.prototype.hasAlert = function() {
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) {
jspb.Message.setProto3StringField(this, 10, value);
return jspb.Message.setProto3StringField(this, 10, value);
};
/**
* 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}
*/
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) {
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) {
jspb.Message.setProto3StringField(this, 12, value);
return jspb.Message.setProto3StringField(this, 12, value);
};
/**
* 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}
*/
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) {
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) {
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() {
this.setData(undefined);
return this.setData(undefined);
};
/**
* Returns whether this field is set.
* @return {!boolean}
* @return {boolean}
*/
proto.proto.NotificationRequest.prototype.hasData = function() {
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) {
jspb.Message.setProto3StringField(this, 15, value);
return jspb.Message.setProto3StringField(this, 15, value);
};
/**
* 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
* optional Priority Priority = 16;
* @return {!proto.proto.Priority}
*/
proto.proto.NotificationReply = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
proto.proto.NotificationRequest.prototype.getPriority = function() {
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) {
/**
* 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.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS.
* @param {boolean=} opt_includeInstance Whether to include the JSPB instance
* for transitional soy proto support: http://goto/soy-param-migration
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
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.
* @param {boolean|undefined} includeInstance Whether to include the JSPB
* instance for transitional soy proto support:
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.proto.NotificationReply} msg The msg instance to transform.
* @return {!Object}
@@ -1064,7 +1251,7 @@ proto.proto.NotificationReply.prototype.toObject = function(opt_includeInstance)
*/
proto.proto.NotificationReply.toObject = function(includeInstance, msg) {
var f, obj = {
success: jspb.Message.getFieldWithDefault(msg, 1, false),
success: jspb.Message.getBooleanFieldWithDefault(msg, 1, false),
counts: jspb.Message.getFieldWithDefault(msg, 2, 0)
};
@@ -1158,18 +1345,19 @@ proto.proto.NotificationReply.serializeBinaryToWriter = function(message, writer
/**
* 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}
*/
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) {
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 {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
* @param {number} value
* @return {!proto.proto.NotificationReply} returns this
*/
proto.proto.HealthCheckRequest = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
proto.proto.NotificationReply.prototype.setCounts = function(value) {
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) {
/**
* 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.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS.
* @param {boolean=} opt_includeInstance Whether to include the JSPB instance
* for transitional soy proto support: http://goto/soy-param-migration
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
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.
* @param {boolean|undefined} includeInstance Whether to include the JSPB
* instance for transitional soy proto support:
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.proto.HealthCheckRequest} msg The msg instance to transform.
* @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 {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
* @param {string} value
* @return {!proto.proto.HealthCheckRequest} returns this
*/
proto.proto.HealthCheckResponse = function(opt_data) {
jspb.Message.initialize(this, opt_data, 0, -1, null, null);
proto.proto.HealthCheckRequest.prototype.setService = function(value) {
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) {
/**
* 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.
* Optional fields that are not set will be set to undefined.
* To access a reserved field use, foo.pb_<name>, eg, foo.pb_default.
* For the list of reserved names please see:
* com.google.apps.jspb.JsClassTemplate.JS_RESERVED_WORDS.
* @param {boolean=} opt_includeInstance Whether to include the JSPB instance
* for transitional soy proto support: http://goto/soy-param-migration
* net/proto2/compiler/js/internal/generator.cc#kKeyword.
* @param {boolean=} opt_includeInstance Deprecated. whether to include the
* JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @return {!Object}
*/
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.
* @param {boolean|undefined} includeInstance Whether to include the JSPB
* instance for transitional soy proto support:
* @param {boolean|undefined} includeInstance Deprecated. Whether to include
* the JSPB instance for transitional soy proto support:
* http://goto/soy-param-migration
* @param {!proto.proto.HealthCheckResponse} msg The msg instance to transform.
* @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) {
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);

File diff suppressed because it is too large Load Diff

View File

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

View File

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