api.proto 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. syntax = "proto3";
  2. package bbq.service.push.v1;
  3. import "github.com/gogo/protobuf/gogoproto/gogo.proto";
  4. option go_package = "v1";
  5. option (gogoproto.goproto_getters_all) = false;
  6. option (gogoproto.goproto_stringer_all) = false;
  7. option (gogoproto.stringer_all) = true;
  8. message Device {
  9. string register_id = 1 [(gogoproto.jsontag) = "register_id",(gogoproto.moretags) = "form:\"register_id\"",(gogoproto.customname) = "RegisterID"];
  10. int32 platform = 2 [(gogoproto.jsontag) = "platform",(gogoproto.moretags) = "form:\"platform\"",(gogoproto.customname) = "Platform"];
  11. int32 sdk = 3 [(gogoproto.jsontag) = "sdk",(gogoproto.moretags) = "form:\"sdk\"",(gogoproto.customname) = "SDK"];
  12. int64 send_no = 4 [(gogoproto.jsontag) = "send_no",(gogoproto.moretags) = "form:\"send_no\"",(gogoproto.customname) = "SendNo"];
  13. }
  14. message Extra {
  15. string token = 1 [(gogoproto.jsontag) = "token",(gogoproto.moretags) = "form:\"token\"",(gogoproto.customname) = "Token"];
  16. string schema = 2 [(gogoproto.jsontag) = "schema",(gogoproto.moretags) = "form:\"schema\"",(gogoproto.customname) = "Schema"];
  17. }
  18. message NotificationBody {
  19. string title = 1 [(gogoproto.jsontag) = "title",(gogoproto.moretags) = "form:\"title\"",(gogoproto.customname) = "Title"];
  20. string content = 2 [(gogoproto.jsontag) = "content",(gogoproto.moretags) = "form:\"content\"",(gogoproto.customname) = "Content"];
  21. string sound = 3 [(gogoproto.jsontag) = "sound",(gogoproto.moretags) = "form:\"sound\"",(gogoproto.customname) = "Sound"];
  22. int32 badge = 4 [(gogoproto.jsontag) = "badge",(gogoproto.moretags) = "form:\"badge\"",(gogoproto.customname) = "Badge"];
  23. string extra = 5 [(gogoproto.jsontag) = "extra",(gogoproto.moretags) = "form:\"extra\"",(gogoproto.customname) = "Extra"];
  24. }
  25. message MessageBody {
  26. string title = 1 [(gogoproto.jsontag) = "title",(gogoproto.moretags) = "form:\"title\"",(gogoproto.customname) = "Title"];
  27. string content = 2 [(gogoproto.jsontag) = "content",(gogoproto.moretags) = "form:\"content\"",(gogoproto.customname) = "Content"];
  28. string content_type = 3 [(gogoproto.jsontag) = "content_type",(gogoproto.moretags) = "form:\"content_type\"",(gogoproto.customname) = "ContentType"];
  29. string extra = 4 [(gogoproto.jsontag) = "extra",(gogoproto.moretags) = "form:\"extra\"",(gogoproto.customname) = "Extra"];
  30. }
  31. message NotificationRequest {
  32. repeated Device dev = 1 [(gogoproto.jsontag) = "dev",(gogoproto.moretags) = "form:\"dev\"",(gogoproto.customname) = "Dev"];
  33. NotificationBody body = 2 [(gogoproto.jsontag) = "body",(gogoproto.moretags) = "form:\"body\"",(gogoproto.customname) = "Body"];
  34. }
  35. message PushResult {
  36. string send_no = 1 [(gogoproto.jsontag) = "sendno,omitempty",(gogoproto.moretags) = "form:\"sendno\"",(gogoproto.customname) = "SendNo"];
  37. string msg_id = 2 [(gogoproto.jsontag) = "msg_id,omitempty",(gogoproto.moretags) = "form:\"msg_id\"",(gogoproto.customname) = "MsgID"];
  38. PushError err = 3 [(gogoproto.jsontag) = "error,omitempty",(gogoproto.moretags) = "form:\"error\"",(gogoproto.customname) = "Error"];
  39. }
  40. message PushError {
  41. string msg = 1 [(gogoproto.jsontag) = "message",(gogoproto.moretags) = "form:\"message\"",(gogoproto.customname) = "Message"];
  42. int32 code = 2 [(gogoproto.jsontag) = "code",(gogoproto.moretags) = "form:\"code\"",(gogoproto.customname) = "Code"];
  43. }
  44. message NotificationResponse {
  45. repeated PushResult result = 1 [(gogoproto.jsontag) = "result",(gogoproto.moretags) = "form:\"result\"",(gogoproto.customname) = "Result"];
  46. }
  47. message MessageRequest {
  48. repeated Device dev = 1 [(gogoproto.jsontag) = "dev",(gogoproto.moretags) = "form:\"dev\"",(gogoproto.customname) = "Dev"];
  49. MessageBody body = 2 [(gogoproto.jsontag) = "body",(gogoproto.moretags) = "form:\"body\"",(gogoproto.customname) = "Body"];
  50. }
  51. message MessageResponse {
  52. repeated PushResult result = 1 [(gogoproto.jsontag) = "result",(gogoproto.moretags) = "form:\"result\"",(gogoproto.customname) = "Result"];
  53. }
  54. service Push {
  55. rpc Notification(NotificationRequest) returns (NotificationResponse);
  56. rpc Message(MessageRequest) returns (MessageResponse);
  57. rpc AsyncNotification(NotificationRequest) returns (NotificationResponse);
  58. rpc AsyncMessage(MessageRequest) returns (MessageResponse);
  59. }