fusenapi/server_api/auth.api

139 lines
3.4 KiB
Plaintext
Raw Normal View History

2023-07-24 09:22:06 +00:00
syntax = "v1"
info (
title: // TODO: add title
desc: // TODO: add description
author: ""
email: ""
)
import "basic.api"
service auth {
2023-10-16 07:19:25 +00:00
// 登录接口
2023-07-24 09:22:06 +00:00
@handler UserLoginHandler
post /api/auth/login(RequestUserLogin) returns (response);
2023-09-04 08:23:11 +00:00
2023-10-16 07:19:25 +00:00
// 注册
2023-08-24 03:47:22 +00:00
@handler UserRegisterHandler
post /api/auth/register(RequestUserRegister) returns (response);
2023-09-04 08:23:11 +00:00
2023-10-16 07:19:25 +00:00
// 获取cookie, 成为游客
2023-07-24 09:22:06 +00:00
@handler AcceptCookieHandler
2023-07-24 11:17:02 +00:00
post /api/auth/accept-cookie(request) returns (response);
2023-09-04 08:23:11 +00:00
2023-10-16 07:19:25 +00:00
// 谷歌第三方登录
2023-07-24 09:22:06 +00:00
@handler UserGoogleLoginHandler
2023-07-24 11:17:02 +00:00
get /api/auth/oauth2/login/google(RequestGoogleLogin) returns (response);
2023-09-04 08:23:11 +00:00
2023-10-16 07:19:25 +00:00
// 邮箱校验
2023-07-26 16:03:38 +00:00
@handler UserEmailConfirmationHandler
get /api/auth/email/confirmation(RequestEmailConfirmation) returns (response);
2023-09-04 08:23:11 +00:00
2023-10-16 07:19:25 +00:00
// 第三方登录,确认使用邮箱
2023-07-24 09:22:06 +00:00
@handler UserEmailRegisterHandler
2023-08-11 09:39:18 +00:00
post /api/auth/oauth2/register(RequestEmailRegister) returns (response);
2023-09-04 08:23:11 +00:00
2023-09-05 07:00:45 +00:00
// 发送重置链接到email
2023-08-11 09:39:18 +00:00
@handler UserResetTokenHandler
2023-09-03 16:06:55 +00:00
post /api/auth/reset/token(RequestUserResetToken) returns (response);
2023-09-04 08:23:11 +00:00
2023-09-05 07:00:45 +00:00
// 重置密码
2023-08-11 09:39:18 +00:00
@handler UserResetPasswordHandler
post /api/auth/reset/password(RequestUserResetPassword) returns (response);
2023-09-04 08:23:11 +00:00
2023-09-05 07:00:45 +00:00
// 获取重定向到html页面
@handler UserResetPasswordHtmlHandler
2023-09-05 07:44:17 +00:00
get /api/auth/reset/password/html(RequestUserResetHtml) returns (response);
2023-09-05 07:00:45 +00:00
2023-10-16 07:19:25 +00:00
// 用于debug 删除帐号
2023-08-29 10:06:39 +00:00
@handler DebugAuthDeleteHandler
2023-08-29 10:13:49 +00:00
post /api/auth/debug/delete(RequestAuthDelete) returns (response);
2023-07-24 09:22:06 +00:00
}
2023-08-11 09:39:18 +00:00
type (
2023-08-24 03:47:22 +00:00
2023-08-29 10:06:39 +00:00
// RequestAuthDelete 用于debug
RequestAuthDelete {
Email string `json:"email"`
}
2023-08-11 09:39:18 +00:00
// UserAddAddressHandler 用户登录请求结构
RequestUserLogin {
Email string `json:"email"`
Password string `json:"password"`
}
// UserLoginHandler 用户登录请求结构
DataUserLogin {
Token string `json:"token"` // 登录jwt token
2023-08-23 08:51:47 +00:00
}
)
type (
// UserAddAddressHandler 用户登录请求结构
RequestUserRegister {
2023-08-27 15:54:28 +00:00
Wid string `json:"wid"` // websocket的id
2023-08-24 03:47:22 +00:00
FirstName string `json:"first_name"` // 首名
LastName string `json:"last_name"` // 名
Resetaurant string `json:"resetaurant"` // 餐厅类型
Email string `json:"email"` // email
Password string `json:"password"` // 密码
2023-08-23 08:51:47 +00:00
}
// UserLoginHandler 用户登录请求结构
2023-08-24 03:47:22 +00:00
// DataUserRegister{
// Token string `json:"token"` // 登录jwt token
// }
2023-08-11 09:39:18 +00:00
)
type (
// RequestUserResetToken 请求重置token, 一定不为null
RequestUserResetToken {
2023-09-04 08:23:11 +00:00
Wid string `json:"wid"`
Email string `json:"email"` // email
2023-08-11 09:39:18 +00:00
}
// UserResetTokenHandler 返回重置token
DataResetToken {
ResetToken string `json:"reset_token"` // 获取重置的token
}
2023-09-05 07:00:45 +00:00
// RequestUserResetPassword 重置密码
RequestUserResetHtml {
2023-09-05 07:44:17 +00:00
ResetToken string `form:"reset_token"`
2023-09-05 07:00:45 +00:00
}
2023-08-11 09:39:18 +00:00
// RequestUserResetPassword 重置密码
RequestUserResetPassword {
2023-09-05 07:00:45 +00:00
// Wid string `json:"wid"`
// Email string `json:"email"` // email
ResetToken string `json:"reset_token"`
NewPassword string `json:"new_password"`
2023-08-11 09:39:18 +00:00
}
)
2023-07-24 09:22:06 +00:00
type RequestGoogleLogin {
Code string `form:"code"`
Scope string `form:"scope"`
AuthUser string `form:"authuser"`
Prompt string `form:"prompt"`
2023-07-26 16:03:38 +00:00
}
type RequestEmailConfirmation {
2023-09-03 17:40:28 +00:00
Token string `form:"token"` // 操作Token
OpType string `form:"optype"` // 操作类型
2023-07-24 09:22:06 +00:00
}
type RequestEmailRegister {
2023-08-11 04:07:26 +00:00
Wid string `json:"wid"`
2023-08-24 03:47:22 +00:00
Email string `json:"email"`
2023-07-24 09:22:06 +00:00
RegisterToken string `json:"register_token"`
}
// DataGuest 游客获取toekn请求结构
type DataGuest {
Token string `json:"token"` // 登录jwt token
}