Files

59 lines
1.5 KiB
Go
Raw Permalink Normal View History

2024-09-13 15:57:29 +08:00
package api
2025-02-12 19:46:39 +08:00
import "github.com/lejianwen/rustdesk-api/v2/model"
2024-09-13 15:57:29 +08:00
/*
pub enum UserStatus {
Disabled = 0,
Normal = 1,
Unverified = -1,
}
*/
/*
UserPayload
String name = ”;
String email = ”;
String note = ”;
UserStatus status;
bool isAdmin = false;
*/
type UserPayload struct {
2024-09-19 10:44:49 +08:00
Name string `json:"name"`
Email string `json:"email"`
Note string `json:"note"`
IsAdmin *bool `json:"is_admin"`
Status int `json:"status"`
Info map[string]interface{} `json:"info"`
2024-09-13 15:57:29 +08:00
}
func (up *UserPayload) FromUser(user *model.User) *UserPayload {
up.Name = user.Username
2024-11-02 04:01:28 +08:00
up.Email = user.Email
2024-09-13 15:57:29 +08:00
up.IsAdmin = user.IsAdmin
up.Status = int(user.Status)
2024-09-19 10:44:49 +08:00
up.Info = map[string]interface{}{}
2024-09-13 15:57:29 +08:00
return up
}
/*
class HttpType {
static const kAuthReqTypeAccount = "account";
static const kAuthReqTypeMobile = "mobile";
static const kAuthReqTypeSMSCode = "sms_code";
static const kAuthReqTypeEmailCode = "email_code";
static const kAuthReqTypeTfaCode = "tfa_code";
static const kAuthResTypeToken = "access_token";
static const kAuthResTypeEmailCheck = "email_check";
static const kAuthResTypeTfaCheck = "tfa_check";
}
*/
type LoginRes struct {
Type string `json:"type"`
AccessToken string `json:"access_token"`
User UserPayload `json:"user"`
2024-09-19 10:44:49 +08:00
Secret string `json:"secret,omitempty"`
TfaType string `json:"tfa_type,omitempty"`
2024-09-13 15:57:29 +08:00
}