syntax = "proto3"; package saasapi; option go_package = "./saasapi"; // SaasReq 命令请求 message SaasReq { UserIdType userid_type = 1; // 用户ID类型 string appid = 2; // 小程序/小游戏/公众号/视频号的appid bool async = 4; // 是否异步执行 oneof cmd { Write write = 10; // 批量写入 Read read = 11; // 批量读取 } } // Write 批量写入命令 message Write { repeated WriteCmd write_cmds = 1; // 批量写入命令 } // WriteCmd 写入命令 message WriteCmd { string userid = 1; // 用户ID Bytes write_bytes = 2; // byte区域 Uint32s write_uint32s = 3; // uint32区域 FlagsWithExpire write_flags_with_expire = 4; // 标志位区域 bool is_full_overwrite = 5; // 是否全量覆盖 } // Bytes 写入byte区域 message Bytes { bytes bytes = 1; // 写入的byte uint64 index_1 = 2; // 写入byte的索引值(0..63) uint64 index_2 = 3; // 写入byte的索引值(64..127) } // Uint32s 写入uint32区域 message Uint32s { repeated uint32 uint32s = 1; // 写入的uint32 uint64 index_1 = 2; // 写入uint32的索引值(0..15) 最多 16 个 //uint64 index_2 = 3; // 写入uint32的索引值(64..127)(当前不支持) } // FlagsWithExpire 写入标志位区域 message FlagsWithExpire { repeated FlagWithExpire flags_with_expire = 1; // 写入的标志位 uint64 index_1 = 2; // 写入标志位的索引值 } // FlagWithExpire 标志位 message FlagWithExpire { bool flag = 1; // 标志位 bool default_flag = 2; // 默认值。超时后则回到默认值。 uint32 expire = 3; // 过期时间,为 0 则永不过期 } // UserIdType 用户 ID 类型 enum UserIdType { DEVICEID = 0; // 设备号 OPENID = 1; // OpenId } // Write 批量读取命令 message Read { repeated ReadCmd read_cmds = 1; // 批量获取命令 } // WriteCmd 读取命令 message ReadCmd { string userid = 1; // 用户ID } // SaasRes 命令返回 message SaasRes { ErrorCode code = 1; // 返回码 string status = 2; // 返回信息的文本提示 repeated CmdsResItem cmd_res = 3; // 返回的命令 } // CmdsResItem 读取命令返回内容 message CmdsResItem { uint32 cmd_index = 1; // 命令索引 CmdErrorCode cmd_code = 2; // 状态 bytes bytes = 3; // byte区域 repeated uint32 uint32s = 4; // uint32区域 repeated FlagWithExpire flags_with_expire = 5; // 标志位区域 } // ErrorCode 返回码 enum ErrorCode { SUCC = 0; // 成功 INVALID_ACCOUNT = 101; // Account不合法 INVALID_TIMESTAMP = 102; // 头信息缺少时间戳 INVALID_SIGNATURE = 103; // 头信息缺少签名 AUTH_FAIL = 104; // 签名较验失败 DISABLED_ACCOUNT = 105; // 账号已禁用 INVALID_CONTENT_TYPE = 110; // 非法的Content-Type READ_BODY = 111; // 读取 http body 失败 DECODE_BODY = 112; // 解码 body 失败 QPS_LIMIT = 113; // 并发请求量超限 CMDS_LIMIT = 114; // 命令数量超限 CMDS_NULL = 115; // 命令为空 } enum CmdErrorCode { OK = 0; // 成功 }