initial commit
This commit is contained in:
61
api/gateway.api
Normal file
61
api/gateway.api
Normal file
@ -0,0 +1,61 @@
|
||||
syntax = "v1"
|
||||
|
||||
type RegisterReq {
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password"`
|
||||
Email string `json:"email"`
|
||||
}
|
||||
|
||||
type RegisterResp {
|
||||
UserId string `json:"user_id"`
|
||||
}
|
||||
|
||||
type LoginReq {
|
||||
Username string `json:"username"`
|
||||
Password string `json:"password"`
|
||||
}
|
||||
|
||||
type LoginResp {
|
||||
Token string `json:"token"`
|
||||
ExpiresAt int64 `json:"expires_at"`
|
||||
}
|
||||
|
||||
type LogoutReq {
|
||||
Token string `json:"token"`
|
||||
}
|
||||
|
||||
type LogoutResp {
|
||||
Success bool `json:"success"`
|
||||
}
|
||||
|
||||
type GetUserInfoReq {
|
||||
UserId string `path:"user_id"`
|
||||
}
|
||||
|
||||
type GetUserInfoResp {
|
||||
UserId string `json:"user_id"`
|
||||
Username string `json:"username"`
|
||||
Email string `json:"email"`
|
||||
CreatedAt int64 `json:"created_at"`
|
||||
Roles []string `json:"roles"`
|
||||
}
|
||||
|
||||
service user-api {
|
||||
@handler registerHandler
|
||||
post /api/user/register (RegisterReq) returns (RegisterResp)
|
||||
|
||||
@handler loginHandler
|
||||
post /api/user/login (LoginReq) returns (LoginResp)
|
||||
}
|
||||
|
||||
@server (
|
||||
jwt: JwtAuth
|
||||
)
|
||||
service user-api {
|
||||
@handler logoutHandler
|
||||
post /api/user/logout (LogoutReq) returns (LogoutResp)
|
||||
|
||||
@handler getUserInfoHandler
|
||||
get /api/user/:user_id (GetUserInfoReq) returns (GetUserInfoResp)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user