publish_registration.proto 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. syntax = "proto3";
  2. package api.push.v2;
  3. import "google/api/annotations.proto";
  4. import "validate/validate.proto";
  5. option go_package = "w303a/server/apis/push/v2;v2";
  6. option java_multiple_files = true;
  7. option java_package = "apis.push.v2";
  8. service PublishRegistration {
  9. // 订阅推送
  10. rpc Subscribe(RegistrationRequest) returns (RegistrationResponse) {
  11. option (google.api.http) = {
  12. post: "/apis/v2/messagectx/publish/registration"
  13. body: "*"
  14. };
  15. }
  16. // 取消订阅推送
  17. rpc Unsubscribe(RegistrationRequest) returns (RegistrationResponse) {
  18. option (google.api.http) = {
  19. delete: "/apis/v2/messagectx/publish/registration"
  20. };
  21. }
  22. }
  23. message RegistrationRequest {
  24. // 设备系统
  25. DeviceSystem deviceSystem = 1 [(validate.rules).enum.defined_only = true];
  26. // 设备系统版本
  27. string deviceSystemVersion = 2 [(validate.rules).string.min_len = 1];
  28. // 设备厂商
  29. string deviceManufacturer = 3 [(validate.rules).string.min_len = 1];
  30. // 设备型号
  31. string deviceModel = 4 [(validate.rules).string.min_len = 1];
  32. // 推送用户 ID
  33. string userId = 5 [(validate.rules).string.min_len = 1];
  34. // 推送平台
  35. RegistrantPlatformType registrantPlatformType = 6 [(validate.rules).enum.defined_only = true];
  36. // 推送 regId
  37. // 已知的 APNs 是一个 Token 类型的格式,其他的平台基本上都是ID 的形式
  38. // IOS 的 APNs 有使用这个字段,推送 ID 字段是必须的
  39. string regId = 7 [(validate.rules).string.min_len = 1];
  40. }
  41. message RegistrationResponse {}
  42. // 设备系统枚举
  43. enum DeviceSystem {
  44. ANDROID = 0;
  45. IOS = 1;
  46. }
  47. // 推送人使用的平台枚举
  48. enum RegistrantPlatformType {
  49. // 其他平台(极光推送)
  50. OTHER = 0;
  51. // 华为
  52. HUAWEI = 1;
  53. // 小米
  54. XIAOMI = 2;
  55. // OPPO
  56. OPPO = 3;
  57. // VIVO
  58. VIVO = 4;
  59. // 苹果 APNS
  60. APNS = 5;
  61. }