123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151 |
- syntax = "proto3";
- package api.user.v2;
- import "google/api/annotations.proto";
- import "validate/validate.proto";
- option go_package = "sikey/w303a/http/api/user/v2;v2";
- option java_multiple_files = true;
- option java_package = "api.user.v2";
- service Child {
- // 获取用户自己的小孩列表
- rpc GetChild(GetChildRequest) returns (GetChildResponse) {
- option (google.api.http) = {
- get: "/apis/v2/userctx/user/child/get"
- };
- }
- // 创建新的小孩
- rpc CreateChild(CreateChildRequest) returns (CreateChildResponse) {
- option (google.api.http) = {
- post: "/apis/v2/userctx/user/child/create"
- body: "*"
- };
- }
- // 更新小孩信息
- rpc UpdateChild(UpdateChildRequest) returns(UpdateChildResponse) {
- option (google.api.http) = {
- post: "/apis/v2/userctx/user/child/update"
- body: "*"
- };
- }
- // 删除小孩
- rpc DeleteChild(DeleteChildRequest) returns (DeleteChildResponse) {
- option (google.api.http) = {
- get: "/apis/v2/userctx/user/child/delete"
- };
- }
- }
- enum Gender {
- // 未知
- UNKNOWN = 0;
- // 男
- MAN = 2;
- // 女
- WOMAN = 3;
- }
- message GetChildRequest {}
- message GetChildResponse {
- repeated Child childList = 1;
- message Child {
- // 小孩ID
- string cid = 1;
- int32 stepCount = 2;
- string name = 3;
- optional string avatar = 4;
- // 绑定的设备
- Device device = 5;
- // 最后一次位置
- Location lastLocation = 6;
- }
- message Device {
- int64 did = 1; // 设备ID
- int32 battery = 2; // 电池电量
- int32 signal = 3; // 当前信号值
- int32 signalMax = 4; // 最大信号值
- string ticket = 5;
- }
- message Location {
- string latitude = 1;
- string longitude = 2;
- int64 positionTime = 3;
- int32 radius = 4;
- enum PointType {
- // 未知
- UNKNOWN = 0;
- // GPS
- GPS = 1;
- // WIFI
- WIFI = 2;
- // 基站
- CELL = 3;
- // IP
- IP = 4;
- }
- PointType pointType = 5;
- }
- }
- message CreateChildRequest {
- // 小孩姓名
- string name = 1 [(validate.rules).string = {min_len:1}];
- // 小孩电话
- string phoneNumber = 2 [(validate.rules).string = {pattern: "^1[3-9]\\d{9}$"}];
- // 小孩电话区号
- string areaCode = 3 [(validate.rules).string = {min_len: 1}];
- // 小孩头像
- optional string avatar = 4;
- // 小孩生日
- optional string birthday = 5;
- // 小孩对自己的称谓
- string appellation = 6 [(validate.rules).string = {min_len:1}];
- // 小孩性别
- Gender gender = 7 [(validate.rules).enum.defined_only = true];
- // 小孩体重
- int32 weight = 8 [(validate.rules).int32.gte = 100, (validate.rules).int32.lte = 200];
- // 小孩身高
- int32 height = 9 [(validate.rules).int32.gte = 100, (validate.rules).int32.lte = 200];
- }
- message CreateChildResponse {string cid = 1;}
- message UpdateChildRequest {
- // 小孩姓名
- string name = 1 [(validate.rules).string = {min_len:1}];
- // 小孩电话
- string phoneNumber = 2 [(validate.rules).string = {pattern: "^1[3-9]\\d{9}$"}];
- // 小孩电话区号
- string areaCode = 3 [(validate.rules).string = {min_len: 1}];
- // 小孩头像
- string avatar = 4;
- // 小孩生日
- string birthday = 5;
- // 小孩对自己的称谓
- string appellation = 6 [(validate.rules).string = {min_len:1}];
- // 小孩性别
- Gender gender = 7 [(validate.rules).enum.defined_only = true];
- // 小孩体重
- int32 weight = 8 [(validate.rules).int32.gte = 100, (validate.rules).int32.lte = 200];
- // 小孩身高
- int32 height = 9 [(validate.rules).int32.gte = 100, (validate.rules).int32.lte = 200];
- // 小孩ID
- string cid = 10;
- }
- message UpdateChildResponse {}
- message DeleteChildRequest {
- string cid = 1 [(validate.rules).string = {min_len:1}];
- }
- message DeleteChildResponse {}
|