调整接口结构
This commit is contained in:
7
.vscode/settings.json
vendored
Normal file
7
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"protobuf.additionalPaths": ["src"],
|
||||
"protobuf.sourceRoot": "src",
|
||||
"protoc": {
|
||||
"options": ["--proto_path=src"]
|
||||
}
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
syntax = "proto3";
|
||||
package account.v1;
|
||||
option go_package = "git.shenxianhe.cn/shenxianhe/sdk/account/v1;accountv1";
|
||||
|
||||
// 认证类型枚举
|
||||
enum AuthenticationType {
|
||||
AUTHENTICATION_TYPE_UNSPECIFIED = 0;
|
||||
AUTHENTICATION_TYPE_NAME = 1; // 用户名
|
||||
AUTHENTICATION_TYPE_PHONE = 2; // 手机号
|
||||
AUTHENTICATION_TYPE_EMAIL = 3; // 邮箱
|
||||
AUTHENTICATION_TYPE_WECHAT = 4; // 微信
|
||||
}
|
||||
|
||||
message SendCredentialRequest {
|
||||
AuthenticationType auth_type = 1; // 认证类型
|
||||
string auth_id = 2; // 认证ID,根据auth_type存储不同的账号信息
|
||||
}
|
||||
|
||||
message SendCredentialResponse {}
|
||||
|
||||
message AuthRequest {
|
||||
AuthenticationType auth_type = 1; // 认证类型
|
||||
string auth_id = 2; // 认证ID,根据auth_type存储不同的账号信息
|
||||
string credential = 3; // 凭证,可以是验证码或密码
|
||||
string invitation_code = 4; // 邀请码
|
||||
}
|
||||
|
||||
message AuthResponse { string token = 1; }
|
||||
|
||||
message SetPasswordRequest {
|
||||
AuthenticationType auth_type = 1; // 认证类型
|
||||
string auth_id = 2; // 认证ID,根据auth_type存储不同的账号信息
|
||||
string credential = 3; // 凭证,可以是验证码或旧密码
|
||||
string password = 4; // 新密码
|
||||
}
|
||||
message SetPasswordResponse {}
|
||||
|
||||
message SetNameRequest { string name = 1; }
|
||||
message SetNameResponse {}
|
||||
|
||||
message GetAvatarUploadURLRequest {}
|
||||
message GetAvatarUploadURLResponse { string url = 1; }
|
||||
message SetAvatarRequest { string url = 1; }
|
||||
message SetAvatarResponse {}
|
||||
|
||||
message GetUserInfoRequest {}
|
||||
message GetUserInfoResponse {
|
||||
string id = 1;
|
||||
string avatar = 2;
|
||||
string invitation_code = 3;
|
||||
string name = 4;
|
||||
string phone = 5;
|
||||
string email = 6;
|
||||
}
|
||||
|
||||
service AccountService {
|
||||
rpc SendCredential(SendCredentialRequest) returns (SendCredentialResponse);
|
||||
rpc Auth(AuthRequest) returns (AuthResponse);
|
||||
rpc SetPassword(SetPasswordRequest) returns (SetPasswordResponse);
|
||||
rpc SetName(SetNameRequest) returns (SetNameResponse);
|
||||
rpc GetAvatarUploadURL(GetAvatarUploadURLRequest)
|
||||
returns (GetAvatarUploadURLResponse);
|
||||
rpc SetAvatar(SetAvatarRequest) returns (SetAvatarResponse);
|
||||
rpc GetUserInfo(GetUserInfoRequest) returns (GetUserInfoResponse);
|
||||
}
|
||||
13
src/admin/v1/service.proto
Normal file
13
src/admin/v1/service.proto
Normal file
@@ -0,0 +1,13 @@
|
||||
syntax = "proto3";
|
||||
package admin.v1;
|
||||
option go_package = "git.shenxianhe.cn/shenxianhe/sdk/admin/v1;adminv1";
|
||||
|
||||
import "admin/v1/sms.proto";
|
||||
import "admin/v1/user.proto";
|
||||
|
||||
service AdminService {
|
||||
rpc ListSMSSign(ListSMSSignRequest) returns (ListSMSSignResponse);
|
||||
rpc SendSMS(SendSMSRequest) returns (SendSMSResponse);
|
||||
|
||||
rpc GetUserInfo(GetUserInfoRequest) returns (GetUserInfoResponse);
|
||||
}
|
||||
36
src/admin/v1/sms.proto
Normal file
36
src/admin/v1/sms.proto
Normal file
@@ -0,0 +1,36 @@
|
||||
syntax = "proto3";
|
||||
package admin.v1;
|
||||
option go_package = "git.shenxianhe.cn/shenxianhe/sdk/admin/v1;adminv1";
|
||||
|
||||
import "enums/v1/sms.proto";
|
||||
|
||||
message SendSMSRequest {
|
||||
string phone = 1;
|
||||
string sign_name = 2;
|
||||
string template_code = 3;
|
||||
map<string, string> template_params = 4;
|
||||
}
|
||||
|
||||
message SendSMSResponse {}
|
||||
|
||||
message ListSMSSignRequest { int32 offset = 1; }
|
||||
|
||||
message SMSSignReason {
|
||||
string content = 1;
|
||||
string sub_content = 2;
|
||||
int32 create_at = 3;
|
||||
}
|
||||
|
||||
message SMSSign {
|
||||
string id = 1; // 签名ID
|
||||
string name = 2; // 签名名称
|
||||
enums.v1.SMSSignStatus status = 3; // 签名状态
|
||||
string type = 4; // 签名类型
|
||||
SMSSignReason reasons = 5; // 签名拒绝原因
|
||||
int32 created_at = 6; // 创建时间
|
||||
}
|
||||
|
||||
message ListSMSSignResponse {
|
||||
repeated SMSSign list = 1;
|
||||
int32 count = 2;
|
||||
}
|
||||
17
src/admin/v1/user.proto
Normal file
17
src/admin/v1/user.proto
Normal file
@@ -0,0 +1,17 @@
|
||||
syntax = "proto3";
|
||||
package admin.v1;
|
||||
option go_package = "git.shenxianhe.cn/shenxianhe/sdk/admin/v1;adminv1";
|
||||
|
||||
message GetUserInfoRequest {
|
||||
string user_id = 1;
|
||||
string invitation_code = 2;
|
||||
}
|
||||
message GetUserInfoResponse {
|
||||
string id = 1;
|
||||
string avatar = 2;
|
||||
string invitation_code = 3;
|
||||
string description = 4;
|
||||
string name = 5;
|
||||
string phone = 6;
|
||||
string email = 7;
|
||||
}
|
||||
11
src/enums/v1/sms.proto
Normal file
11
src/enums/v1/sms.proto
Normal file
@@ -0,0 +1,11 @@
|
||||
syntax = "proto3";
|
||||
package enums.v1;
|
||||
option go_package = "git.shenxianhe.cn/shenxianhe/sdk/enums/v1;enumsv1";
|
||||
|
||||
enum SMSSignStatus {
|
||||
SMS_SIGN_STATUS_UNSPECIFIED = 0;
|
||||
SMS_SIGN_STATUS_APPLYING = 1; // 审核中
|
||||
SMS_SIGN_STATUS_PASSED = 2; // 审核通过
|
||||
SMS_SIGN_STATUS_REJECTED = 3; // 审核拒绝
|
||||
SMS_SIGN_STATUS_CANCELED = 4; // 已取消
|
||||
}
|
||||
12
src/enums/v1/user.proto
Normal file
12
src/enums/v1/user.proto
Normal file
@@ -0,0 +1,12 @@
|
||||
syntax = "proto3";
|
||||
package enums.v1;
|
||||
option go_package = "git.shenxianhe.cn/shenxianhe/sdk/enums/v1;enumsv1";
|
||||
|
||||
// 认证类型枚举
|
||||
enum AuthenticationType {
|
||||
AUTHENTICATION_TYPE_UNSPECIFIED = 0;
|
||||
AUTHENTICATION_TYPE_NAME = 1; // 用户名
|
||||
AUTHENTICATION_TYPE_PHONE = 2; // 手机号
|
||||
AUTHENTICATION_TYPE_EMAIL = 3; // 邮箱
|
||||
AUTHENTICATION_TYPE_WECHAT = 4; // 微信
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
syntax = "proto3";
|
||||
package notification.v1;
|
||||
option go_package = "git.shenxianhe.cn/shenxianhe/sdk/notification/v1;notificationv1";
|
||||
|
||||
message SendSMSRequest {
|
||||
string phone = 1;
|
||||
string sign_name = 2;
|
||||
string template_code = 3;
|
||||
map<string, string> template_params = 4;
|
||||
}
|
||||
|
||||
message SendSMSResponse {}
|
||||
|
||||
message ListSMSSignRequest { int32 offset = 1; }
|
||||
|
||||
enum SMSSignStatus {
|
||||
SMS_SIGN_STATUS_UNSPECIFIED = 0;
|
||||
SMS_SIGN_STATUS_APPLYING = 1; // 审核中
|
||||
SMS_SIGN_STATUS_PASSED = 2; // 审核通过
|
||||
SMS_SIGN_STATUS_REJECTED = 3; // 审核拒绝
|
||||
SMS_SIGN_STATUS_CANCELED = 4; // 已取消
|
||||
}
|
||||
|
||||
message SMSSignReason {
|
||||
string content = 1;
|
||||
string sub_content = 2;
|
||||
int32 create_at = 3;
|
||||
}
|
||||
|
||||
message SMSSign {
|
||||
string id = 1; // 签名ID
|
||||
string name = 2; // 签名名称
|
||||
SMSSignStatus status = 3; // 签名状态
|
||||
string type = 4; // 签名类型
|
||||
SMSSignReason reasons = 5; // 签名拒绝原因
|
||||
int32 created_at = 6; // 创建时间
|
||||
}
|
||||
|
||||
message ListSMSSignResponse {
|
||||
repeated SMSSign list = 1;
|
||||
int32 count = 2;
|
||||
}
|
||||
|
||||
service NotificationService {
|
||||
rpc ListSMSSign(ListSMSSignRequest) returns (ListSMSSignResponse);
|
||||
rpc SendSMS(SendSMSRequest) returns (SendSMSResponse);
|
||||
}
|
||||
17
src/user/v1/service.proto
Normal file
17
src/user/v1/service.proto
Normal file
@@ -0,0 +1,17 @@
|
||||
syntax = "proto3";
|
||||
package user.v1;
|
||||
option go_package = "git.shenxianhe.cn/shenxianhe/sdk/user/v1;userv1";
|
||||
|
||||
import "user/v1/user.proto";
|
||||
|
||||
service UserService {
|
||||
rpc SendCredential(SendCredentialRequest) returns (SendCredentialResponse);
|
||||
rpc Auth(AuthRequest) returns (AuthResponse);
|
||||
rpc SetPassword(SetPasswordRequest) returns (SetPasswordResponse);
|
||||
rpc SetName(SetNameRequest) returns (SetNameResponse);
|
||||
rpc GetAvatarUploadURL(GetAvatarUploadURLRequest)
|
||||
returns (GetAvatarUploadURLResponse);
|
||||
rpc SetAvatar(SetAvatarRequest) returns (SetAvatarResponse);
|
||||
rpc SetDescription(SetDescriptionRequest) returns (SetDescriptionResponse);
|
||||
rpc GetUserInfo(GetUserInfoRequest) returns (GetUserInfoResponse);
|
||||
}
|
||||
54
src/user/v1/user.proto
Normal file
54
src/user/v1/user.proto
Normal file
@@ -0,0 +1,54 @@
|
||||
syntax = "proto3";
|
||||
package user.v1;
|
||||
option go_package = "git.shenxianhe.cn/shenxianhe/sdk/user/v1;userv1";
|
||||
|
||||
import "enums/v1/user.proto";
|
||||
|
||||
message SendCredentialRequest {
|
||||
enums.v1.AuthenticationType auth_type = 1; // 认证类型
|
||||
string auth_id = 2; // 认证ID,根据auth_type存储不同的账号信息
|
||||
}
|
||||
|
||||
message SendCredentialResponse {}
|
||||
|
||||
message AuthRequest {
|
||||
enums.v1.AuthenticationType auth_type = 1; // 认证类型
|
||||
string auth_id = 2; // 认证ID,根据auth_type存储不同的账号信息
|
||||
string credential = 3; // 凭证,可以是验证码或密码
|
||||
string invitation_code = 4; // 邀请码
|
||||
}
|
||||
|
||||
message AuthResponse { string token = 1; }
|
||||
|
||||
message SetPasswordRequest {
|
||||
enums.v1.AuthenticationType auth_type = 1; // 认证类型
|
||||
string auth_id = 2; // 认证ID,根据auth_type存储不同的账号信息
|
||||
string credential = 3; // 凭证,可以是验证码或旧密码
|
||||
string password = 4; // 新密码
|
||||
}
|
||||
message SetPasswordResponse {}
|
||||
|
||||
message SetNameRequest { string name = 1; }
|
||||
message SetNameResponse {}
|
||||
|
||||
message GetAvatarUploadURLRequest {}
|
||||
message GetAvatarUploadURLResponse {
|
||||
string key = 1;
|
||||
string url = 2;
|
||||
}
|
||||
message SetAvatarRequest { string key = 1; }
|
||||
message SetAvatarResponse {}
|
||||
|
||||
message SetDescriptionRequest { string description = 1; }
|
||||
message SetDescriptionResponse {}
|
||||
|
||||
message GetUserInfoRequest {}
|
||||
message GetUserInfoResponse {
|
||||
string id = 1;
|
||||
string avatar = 2;
|
||||
string invitation_code = 3;
|
||||
string description = 4;
|
||||
string name = 5;
|
||||
string phone = 6;
|
||||
string email = 7;
|
||||
}
|
||||
@@ -1 +1 @@
|
||||
1.4.0
|
||||
1.6.0
|
||||
|
||||
Reference in New Issue
Block a user