child.proto 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. syntax = "proto3";
  2. package api.user.v2;
  3. import "google/api/annotations.proto";
  4. import "validate/validate.proto";
  5. option go_package = "w303a/server/apis/user/v2;v2";
  6. option java_multiple_files = true;
  7. option java_package = "apis.user.v2";
  8. service Child {
  9. // 获取用户自己的小孩列表
  10. rpc GetChild(GetChildRequest) returns (GetChildResponse) {
  11. option (google.api.http) = {
  12. get: "/apis/v2/userctx/user/child/get"
  13. };
  14. }
  15. // 创建新的小孩
  16. rpc CreateChild(CreateChildRequest) returns (CreateChildResponse) {
  17. option (google.api.http) = {
  18. post: "/apis/v2/userctx/user/child/create"
  19. body: "*"
  20. };
  21. }
  22. // 更新小孩信息
  23. rpc UpdateChild(UpdateChildRequest) returns(UpdateChildResponse) {
  24. option (google.api.http) = {
  25. post: "/apis/v2/userctx/user/child/update"
  26. body: "*"
  27. };
  28. }
  29. // 删除小孩
  30. rpc DeleteChild(DeleteChildRequest) returns (DeleteChildResponse) {
  31. option (google.api.http) = {
  32. get: "/apis/v2/userctx/user/child/delete"
  33. };
  34. }
  35. }
  36. enum Gender {
  37. // 未知
  38. UNKNOWN = 0;
  39. // 男
  40. MAN = 2;
  41. // 女
  42. WOMAN = 3;
  43. }
  44. message GetChildRequest {}
  45. message GetChildResponse {
  46. repeated Child childList = 1;
  47. message Child {
  48. // 小孩ID
  49. string cid = 1;
  50. int32 stepCount = 2;
  51. string name = 3;
  52. string avatar = 4;
  53. // 绑定的设备
  54. Device device = 5;
  55. // 最后一次位置
  56. Location lastLocation = 6;
  57. }
  58. message Device {
  59. int64 did = 1; // 设备ID
  60. int32 battery = 2; // 电池电量
  61. int32 signal = 3; // 当前信号值
  62. int32 signalMax = 4; // 最大信号值
  63. string ticket = 5;
  64. }
  65. message Location {
  66. string latitude = 1;
  67. string longitude = 2;
  68. int64 positionTime = 3;
  69. int32 radius = 4;
  70. enum PointType {
  71. // 未知
  72. UNKNOWN = 0;
  73. // GPS
  74. GPS = 1;
  75. // WIFI
  76. WIFI = 2;
  77. // 基站
  78. CELL = 3;
  79. // IP
  80. IP = 4;
  81. }
  82. PointType pointType = 5;
  83. }
  84. }
  85. message CreateChildRequest {
  86. // 小孩姓名
  87. string name = 1 [(validate.rules).string = {min_len:1}];
  88. // 小孩电话
  89. string phoneNumber = 2 [(validate.rules).string = {pattern: "^1[3-9]\\d{9}$"}];
  90. // 小孩电话区号
  91. string areaCode = 3 [(validate.rules).string = {min_len: 1}];
  92. // 小孩头像
  93. string avatar = 4;
  94. // 小孩生日
  95. string birthday = 5;
  96. // 小孩对自己的称谓
  97. string appellation = 6 [(validate.rules).string = {min_len:1}];
  98. // 小孩性别
  99. Gender gender = 7 [(validate.rules).enum.defined_only = true];
  100. // 小孩体重
  101. int32 weight = 8 [(validate.rules).int32.gte = 100, (validate.rules).int32.lte = 200];
  102. // 小孩身高
  103. int32 height = 9 [(validate.rules).int32.gte = 100, (validate.rules).int32.lte = 200];
  104. }
  105. message CreateChildResponse {string cid = 1;}
  106. message UpdateChildRequest {
  107. // 小孩姓名
  108. string name = 1 [(validate.rules).string = {min_len:1}];
  109. // 小孩电话
  110. string phoneNumber = 2 [(validate.rules).string = {pattern: "^1[3-9]\\d{9}$"}];
  111. // 小孩电话区号
  112. string areaCode = 3 [(validate.rules).string = {min_len: 1}];
  113. // 小孩头像
  114. string avatar = 4;
  115. // 小孩生日
  116. string birthday = 5;
  117. // 小孩对自己的称谓
  118. string appellation = 6 [(validate.rules).string = {min_len:1}];
  119. // 小孩性别
  120. Gender gender = 7 [(validate.rules).enum.defined_only = true];
  121. // 小孩体重
  122. int32 weight = 8 [(validate.rules).int32.gte = 100, (validate.rules).int32.lte = 200];
  123. // 小孩身高
  124. int32 height = 9 [(validate.rules).int32.gte = 100, (validate.rules).int32.lte = 200];
  125. // 小孩ID
  126. string cid = 10;
  127. }
  128. message UpdateChildResponse {}
  129. message DeleteChildRequest {
  130. string cid = 1 [(validate.rules).string = {min_len:1}];
  131. }
  132. message DeleteChildResponse {}