123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- syntax = "proto3";
- package api.push.v2;
- import "google/api/annotations.proto";
- import "validate/validate.proto";
- option go_package = "w303a/server/apis/push/v2;v2";
- option java_multiple_files = true;
- option java_package = "apis.push.v2";
- service PublishRegistration {
- // 订阅推送
- rpc Subscribe(RegistrationRequest) returns (RegistrationResponse) {
- option (google.api.http) = {
- post: "/apis/v2/messagectx/publish/registration"
- body: "*"
- };
- }
- // 取消订阅推送
- rpc Unsubscribe(RegistrationRequest) returns (RegistrationResponse) {
- option (google.api.http) = {
- delete: "/apis/v2/messagectx/publish/registration"
- };
- }
- }
- message RegistrationRequest {
- // 设备系统
- DeviceSystem deviceSystem = 1 [(validate.rules).enum.defined_only = true];
- // 设备系统版本
- string deviceSystemVersion = 2 [(validate.rules).string.min_len = 1];
- // 设备厂商
- string deviceManufacturer = 3 [(validate.rules).string.min_len = 1];
- // 设备型号
- string deviceModel = 4 [(validate.rules).string.min_len = 1];
- // 推送用户 ID
- string userId = 5 [(validate.rules).string.min_len = 1];
- // 推送平台
- RegistrantPlatformType registrantPlatformType = 6 [(validate.rules).enum.defined_only = true];
- // 推送 regId
- // 已知的 APNs 是一个 Token 类型的格式,其他的平台基本上都是ID 的形式
- // IOS 的 APNs 有使用这个字段,推送 ID 字段是必须的
- string regId = 7 [(validate.rules).string.min_len = 1];
- }
- message RegistrationResponse {}
- // 设备系统枚举
- enum DeviceSystem {
- ANDROID = 0;
- IOS = 1;
- }
- // 推送人使用的平台枚举
- enum RegistrantPlatformType {
- // 其他平台(极光推送)
- OTHER = 0;
- // 华为
- HUAWEI = 1;
- // 小米
- XIAOMI = 2;
- // OPPO
- OPPO = 3;
- // VIVO
- VIVO = 4;
- // 苹果 APNS
- APNS = 5;
- }
|