device.proto 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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. /*
  9. 设备服务
  10. - 绑定设备
  11. - 解绑设备
  12. - 查询设备绑定状态
  13. - 设备交换三码
  14. */
  15. service Device {
  16. // 获取设备绑定状态
  17. rpc DeviceBinding(DeviceBindingRequest) returns (DeviceBindingResponse) {
  18. option (google.api.http) = {
  19. get: "/apis/v2/userctx/user/child/device/binding"
  20. };
  21. };
  22. // 绑定设备
  23. rpc DeviceBind(DeviceBindRequest) returns (DeviceBindResponse) {
  24. option (google.api.http) = {
  25. post: "/apis/v2/userctx/user/child/device/bind"
  26. body: "*"
  27. };
  28. };
  29. // 解绑设备
  30. rpc DeviceUnbind(DeviceUnbindRequest) returns (DeviceUnbindResponse) {
  31. option (google.api.http) = {
  32. post: "/apis/v2/userctx/user/child/device/unbind"
  33. body: "*"
  34. };
  35. };
  36. // 交换三码
  37. rpc DeviceExchange(DeviceExchangeRequest) returns (DeviceExchangeResponse) {
  38. option (google.api.http) = {
  39. get: "/apis/v2/userctx/user/child/device/exchange"
  40. };
  41. };
  42. }
  43. // 获取设备绑定状态 Request
  44. message DeviceBindingRequest {
  45. string ticket = 1 [(validate.rules).string.min_len = 1];
  46. };
  47. // 获取设备绑定状态 Response
  48. message DeviceBindingResponse {
  49. // 是否被绑定
  50. bool isBind = 3;
  51. // 被绑定的小孩ID
  52. string cid = 1;
  53. // 设备的 accessToken
  54. // 后续接口需要通过这个来进行交互
  55. string token = 2;
  56. // 体重
  57. int32 weight = 4;
  58. // 身高
  59. int32 height = 5;
  60. };
  61. // 绑定设备 Request
  62. message DeviceBindRequest {
  63. string cid = 1 [(validate.rules).string.min_len = 1, (validate.rules).string.uuid = true];
  64. string ticket = 2 [(validate.rules).string.min_len = 1];
  65. };
  66. // 绑定设备 Response
  67. message DeviceBindResponse {};
  68. // 解绑设备
  69. message DeviceUnbindRequest {
  70. string cid = 1 [(validate.rules).string.min_len = 1, (validate.rules).string.uuid = true];
  71. string ticket = 2 [(validate.rules).string.min_len = 1];
  72. };
  73. // 解绑设备
  74. message DeviceUnbindResponse {};
  75. message DeviceExchangeRequest {
  76. string hc = 1 [(validate.rules).string.min_len = 1];
  77. };
  78. message DeviceExchangeResponse {
  79. // ticket 用于生成设备绑定二维码使用
  80. // 在连接 temp websocket 时也会用到
  81. string ticket = 1;
  82. string aseKey = 2;
  83. string hc = 3;
  84. // 设备激活时间
  85. int64 activationTime = 4;
  86. };