fusenapi/server_api/auth.api
2023-09-04 16:23:11 +08:00

119 lines
3.0 KiB
Plaintext

syntax = "v1"
info (
title: // TODO: add title
desc: // TODO: add description
author: ""
email: ""
)
import "basic.api"
service auth {
@handler UserLoginHandler
post /api/auth/login(RequestUserLogin) returns (response);
@handler UserRegisterHandler
post /api/auth/register(RequestUserRegister) returns (response);
@handler AcceptCookieHandler
post /api/auth/accept-cookie(request) returns (response);
@handler UserGoogleLoginHandler
get /api/auth/oauth2/login/google(RequestGoogleLogin) returns (response);
@handler UserEmailConfirmationHandler
get /api/auth/email/confirmation(RequestEmailConfirmation) returns (response);
@handler UserEmailRegisterHandler
post /api/auth/oauth2/register(RequestEmailRegister) returns (response);
@handler UserResetTokenHandler
post /api/auth/reset/token(RequestUserResetToken) returns (response);
@handler UserResetPasswordHandler
post /api/auth/reset/password(RequestUserResetPassword) returns (response);
@handler DebugAuthDeleteHandler
post /api/auth/debug/delete(RequestAuthDelete) returns (response);
}
type (
// RequestAuthDelete 用于debug
RequestAuthDelete {
Email string `json:"email"`
}
// UserAddAddressHandler 用户登录请求结构
RequestUserLogin {
Email string `json:"email"`
Password string `json:"password"`
}
// UserLoginHandler 用户登录请求结构
DataUserLogin {
Token string `json:"token"` // 登录jwt token
}
)
type (
// UserAddAddressHandler 用户登录请求结构
RequestUserRegister {
Wid string `json:"wid"` // websocket的id
FirstName string `json:"first_name"` // 首名
LastName string `json:"last_name"` // 名
Resetaurant string `json:"resetaurant"` // 餐厅类型
Email string `json:"email"` // email
Password string `json:"password"` // 密码
}
// UserLoginHandler 用户登录请求结构
// DataUserRegister{
// Token string `json:"token"` // 登录jwt token
// }
)
type (
// RequestUserResetToken 请求重置token, 一定不为null
RequestUserResetToken {
Wid string `json:"wid"`
Email string `json:"email"` // email
}
// UserResetTokenHandler 返回重置token
DataResetToken {
ResetToken string `json:"reset_token"` // 获取重置的token
}
// RequestUserResetPassword 重置密码
RequestUserResetPassword {
ResetToken string `json:"reset_token"` // 附带重置token, 确保流程唯一
Password string `json:"password"` // 附带的hash密码
}
)
type RequestGoogleLogin {
Code string `form:"code"`
Scope string `form:"scope"`
AuthUser string `form:"authuser"`
Prompt string `form:"prompt"`
}
type RequestEmailConfirmation {
Token string `form:"token"` // 操作Token
OpType string `form:"optype"` // 操作类型
}
type RequestEmailRegister {
Wid string `json:"wid"`
Email string `json:"email"`
RegisterToken string `json:"register_token"`
}
// DataGuest 游客获取toekn请求结构
type DataGuest {
Token string `json:"token"` // 登录jwt token
}