Documentation
¶
Overview ¶
Package server provides primitives to interact the openapi HTTP API.
Code generated by github.com/deepmap/oapi-codegen DO NOT EDIT.
Index ¶
- func AuthorizeUser(next http.Handler) http.Handler
- func DecryptRegisterToken(token string) (userID, email string, err error)
- func GenerateNewToken() string
- func GenerateRegisterToken(userID, eamil string) (string, error)
- func GenerateToken(userID string) (string, error)
- func GenerateTokenCookie(userID string) (*http.Cookie, error)
- func GetSwagger() (*openapi3.Swagger, error)
- func GetUser(ctx context.Context) string
- func GetUserObject(ctx context.Context) (*ent.User, error)
- func Handler(si ServerInterface) http.Handler
- func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler
- func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler
- func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler
- func Init(ctx context.Context) *chi.Mux
- type ChiServerOptions
- type ClientInfo
- type CreateClientJSONBody
- type CreateClientJSONRequestBody
- type CreateClientRequest
- type CreateUserJSONBody
- type CreateUserJSONRequestBody
- type CreateUserRequest
- type GetUserInfoByClientTokenJSONBody
- type GetUserInfoByClientTokenJSONRequestBody
- type LoginRequest
- type LoginUserJSONBody
- type LoginUserJSONRequestBody
- type Logs
- type MiddlewareFunc
- type Reason
- type RequestToken
- type RequestTokenJSONBody
- type RequestTokenJSONRequestBody
- type Server
- func (s Server) CreateClient(w http.ResponseWriter, r *http.Request)
- func (s Server) CreateUser(w http.ResponseWriter, r *http.Request)
- func (s Server) DeleteClient(w http.ResponseWriter, r *http.Request, clientID string)
- func (s Server) GetClientList(w http.ResponseWriter, r *http.Request)
- func (s Server) GetUser(w http.ResponseWriter, r *http.Request)
- func (s Server) GetUserInfoByClientToken(w http.ResponseWriter, r *http.Request)
- func (s Server) GetUserLogs(w http.ResponseWriter, r *http.Request)
- func (s Server) LoginUser(w http.ResponseWriter, r *http.Request)
- func (s Server) LogoutUser(w http.ResponseWriter, r *http.Request)
- func (s Server) PingPong(w http.ResponseWriter, r *http.Request)
- func (s Server) RequestToken(w http.ResponseWriter, r *http.Request)
- func (s Server) UpdateUser(w http.ResponseWriter, r *http.Request)
- type ServerInterface
- type ServerInterfaceWrapper
- func (siw *ServerInterfaceWrapper) CreateClient(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) CreateUser(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) DeleteClient(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetClientList(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetUser(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetUserInfoByClientToken(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetUserLogs(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) LoginUser(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) LogoutUser(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PingPong(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) RequestToken(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) UpdateUser(w http.ResponseWriter, r *http.Request)
- type UpdateUserJSONBody
- type UpdateUserJSONRequestBody
- type UpdateUserRequest
- type UserInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthorizeUser ¶
AuthorizeUser middleware for validating user token and embed to userinfo to context
func DecryptRegisterToken ¶
func GenerateRegisterToken ¶
func GenerateToken ¶
GenerateToken generate token for user auth
func GenerateTokenCookie ¶
GenerateTokenCookie generate cookie which includes JWT
func GetSwagger ¶
GetSwagger returns the Swagger specification corresponding to the generated code in this file.
func Handler ¶
func Handler(si ServerInterface) http.Handler
Handler creates http.Handler with routing matching OpenAPI spec.
func HandlerFromMux ¶
func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler
HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux.
func HandlerWithOptions ¶
func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler
HandlerWithOptions creates http.Handler with additional options
Types ¶
type ChiServerOptions ¶
type ChiServerOptions struct {
BaseURL string
BaseRouter chi.Router
Middlewares []MiddlewareFunc
}
type ClientInfo ¶
type ClientInfo struct {
// identification of client
ClientID *int `json:"clientID,omitempty"`
// name of the client
ClientName string `json:"clientName"`
Description string `json:"description"`
Link string `json:"link"`
Token *string `json:"token,omitempty"`
Valid bool `json:"valid"`
}
ClientInfo defines model for ClientInfo.
type CreateClientJSONBody ¶
type CreateClientJSONBody CreateClientRequest
CreateClientJSONBody defines parameters for CreateClient.
type CreateClientJSONRequestBody ¶
type CreateClientJSONRequestBody CreateClientJSONBody
CreateClientJSONRequestBody defines body for CreateClient for application/json ContentType.
type CreateClientRequest ¶
type CreateClientRequest struct {
// Embedded struct due to allOf(#/components/schemas/ClientInfo)
ClientInfo `yaml:",inline"`
}
CreateClientRequest defines model for CreateClientRequest.
type CreateUserJSONBody ¶
type CreateUserJSONBody CreateUserRequest
CreateUserJSONBody defines parameters for CreateUser.
type CreateUserJSONRequestBody ¶
type CreateUserJSONRequestBody CreateUserJSONBody
CreateUserJSONRequestBody defines body for CreateUser for application/json ContentType.
type CreateUserRequest ¶
type CreateUserRequest struct {
// Embedded struct due to allOf(#/components/schemas/UserInfo)
UserInfo `yaml:",inline"`
// token sent by email
Token string `json:"token"`
}
CreateUserRequest defines model for CreateUserRequest.
type GetUserInfoByClientTokenJSONBody ¶
type GetUserInfoByClientTokenJSONBody struct {
// client token to auth
Token string `json:"token"`
// userID to get user info
UserID string `json:"userID"`
// userPW to get user info
UserPW string `json:"userPW"`
}
GetUserInfoByClientTokenJSONBody defines parameters for GetUserInfoByClientToken.
type GetUserInfoByClientTokenJSONRequestBody ¶
type GetUserInfoByClientTokenJSONRequestBody GetUserInfoByClientTokenJSONBody
GetUserInfoByClientTokenJSONRequestBody defines body for GetUserInfoByClientToken for application/json ContentType.
type LoginRequest ¶
LoginRequest defines model for LoginRequest.
type LoginUserJSONBody ¶
type LoginUserJSONBody LoginRequest
LoginUserJSONBody defines parameters for LoginUser.
type LoginUserJSONRequestBody ¶
type LoginUserJSONRequestBody LoginUserJSONBody
LoginUserJSONRequestBody defines body for LoginUser for application/json ContentType.
type Logs ¶
type Logs []struct {
// event type
Event string `json:"event"`
// event time
Time string `json:"time"`
}
Logs defines model for Logs.
type MiddlewareFunc ¶
type MiddlewareFunc func(http.HandlerFunc) http.HandlerFunc
type RequestToken ¶
type RequestToken struct {
// email address to send token
Email string `json:"email"`
// userID to sign the token
UserID string `json:"userID"`
}
RequestToken defines model for RequestToken.
type RequestTokenJSONBody ¶
type RequestTokenJSONBody RequestToken
RequestTokenJSONBody defines parameters for RequestToken.
type RequestTokenJSONRequestBody ¶
type RequestTokenJSONRequestBody RequestTokenJSONBody
RequestTokenJSONRequestBody defines body for RequestToken for application/json ContentType.
type Server ¶
type Server struct{}
Server base server struct
func (Server) CreateClient ¶
func (s Server) CreateClient(w http.ResponseWriter, r *http.Request)
CreateClient request for registration (PUT /v1/client)
func (Server) CreateUser ¶
func (s Server) CreateUser(w http.ResponseWriter, r *http.Request)
CreateUser request for registration (PUT /v1/user)
func (Server) DeleteClient ¶
DeleteClient delete client (DELETE /v1/client/{clientID})
func (Server) GetClientList ¶
func (s Server) GetClientList(w http.ResponseWriter, r *http.Request)
GetClientList get client info (GET /v1/client)
func (Server) GetUser ¶
func (s Server) GetUser(w http.ResponseWriter, r *http.Request)
GetUser get user info (GET /v1/user)
func (Server) GetUserInfoByClientToken ¶
func (s Server) GetUserInfoByClientToken(w http.ResponseWriter, r *http.Request)
GetUserInfoByClientToken get user info with client token (POST /v1/client/user)
func (Server) GetUserLogs ¶
func (s Server) GetUserLogs(w http.ResponseWriter, r *http.Request)
GetUserLogs get login history for user (GET /v1/logs)
func (Server) LoginUser ¶
func (s Server) LoginUser(w http.ResponseWriter, r *http.Request)
LoginUser Logs in user (POST /v1/login)
func (Server) LogoutUser ¶
func (s Server) LogoutUser(w http.ResponseWriter, r *http.Request)
LogoutUser Log out user by clear cookie (GET /v1/logout)
func (Server) PingPong ¶
func (s Server) PingPong(w http.ResponseWriter, r *http.Request)
PingPong ping check (GET /v1/ping)
func (Server) RequestToken ¶
func (s Server) RequestToken(w http.ResponseWriter, r *http.Request)
RequestToken request token for registration (POST /v1/token)
func (Server) UpdateUser ¶
func (s Server) UpdateUser(w http.ResponseWriter, r *http.Request)
UpdateUser update user info (POST /v1/user)
type ServerInterface ¶
type ServerInterface interface {
// get client list
// (GET /v1/client)
GetClientList(w http.ResponseWriter, r *http.Request)
// request for registration
// (PUT /v1/client)
CreateClient(w http.ResponseWriter, r *http.Request)
// get user info with client token
// (POST /v1/client/user)
GetUserInfoByClientToken(w http.ResponseWriter, r *http.Request)
// delete client
// (DELETE /v1/client/{clientID})
DeleteClient(w http.ResponseWriter, r *http.Request, clientID string)
// Logs in user
// (POST /v1/login)
LoginUser(w http.ResponseWriter, r *http.Request)
// Log out user by clear cookie
// (GET /v1/logout)
LogoutUser(w http.ResponseWriter, r *http.Request)
// get login history for user
// (GET /v1/logs)
GetUserLogs(w http.ResponseWriter, r *http.Request)
// ping check
// (GET /v1/ping)
PingPong(w http.ResponseWriter, r *http.Request)
// request token for registration
// (POST /v1/token)
RequestToken(w http.ResponseWriter, r *http.Request)
// get user info
// (GET /v1/user)
GetUser(w http.ResponseWriter, r *http.Request)
// update user info
// (POST /v1/user)
UpdateUser(w http.ResponseWriter, r *http.Request)
// request for registration
// (PUT /v1/user)
CreateUser(w http.ResponseWriter, r *http.Request)
}
ServerInterface represents all server handlers.
type ServerInterfaceWrapper ¶
type ServerInterfaceWrapper struct {
Handler ServerInterface
HandlerMiddlewares []MiddlewareFunc
}
ServerInterfaceWrapper converts contexts to parameters.
func (*ServerInterfaceWrapper) CreateClient ¶
func (siw *ServerInterfaceWrapper) CreateClient(w http.ResponseWriter, r *http.Request)
CreateClient operation middleware
func (*ServerInterfaceWrapper) CreateUser ¶
func (siw *ServerInterfaceWrapper) CreateUser(w http.ResponseWriter, r *http.Request)
CreateUser operation middleware
func (*ServerInterfaceWrapper) DeleteClient ¶
func (siw *ServerInterfaceWrapper) DeleteClient(w http.ResponseWriter, r *http.Request)
DeleteClient operation middleware
func (*ServerInterfaceWrapper) GetClientList ¶
func (siw *ServerInterfaceWrapper) GetClientList(w http.ResponseWriter, r *http.Request)
GetClientList operation middleware
func (*ServerInterfaceWrapper) GetUser ¶
func (siw *ServerInterfaceWrapper) GetUser(w http.ResponseWriter, r *http.Request)
GetUser operation middleware
func (*ServerInterfaceWrapper) GetUserInfoByClientToken ¶
func (siw *ServerInterfaceWrapper) GetUserInfoByClientToken(w http.ResponseWriter, r *http.Request)
GetUserInfoByClientToken operation middleware
func (*ServerInterfaceWrapper) GetUserLogs ¶
func (siw *ServerInterfaceWrapper) GetUserLogs(w http.ResponseWriter, r *http.Request)
GetUserLogs operation middleware
func (*ServerInterfaceWrapper) LoginUser ¶
func (siw *ServerInterfaceWrapper) LoginUser(w http.ResponseWriter, r *http.Request)
LoginUser operation middleware
func (*ServerInterfaceWrapper) LogoutUser ¶
func (siw *ServerInterfaceWrapper) LogoutUser(w http.ResponseWriter, r *http.Request)
LogoutUser operation middleware
func (*ServerInterfaceWrapper) PingPong ¶
func (siw *ServerInterfaceWrapper) PingPong(w http.ResponseWriter, r *http.Request)
PingPong operation middleware
func (*ServerInterfaceWrapper) RequestToken ¶
func (siw *ServerInterfaceWrapper) RequestToken(w http.ResponseWriter, r *http.Request)
RequestToken operation middleware
func (*ServerInterfaceWrapper) UpdateUser ¶
func (siw *ServerInterfaceWrapper) UpdateUser(w http.ResponseWriter, r *http.Request)
UpdateUser operation middleware
type UpdateUserJSONBody ¶
type UpdateUserJSONBody UpdateUserRequest
UpdateUserJSONBody defines parameters for UpdateUser.
type UpdateUserJSONRequestBody ¶
type UpdateUserJSONRequestBody UpdateUserJSONBody
UpdateUserJSONRequestBody defines body for UpdateUser for application/json ContentType.
type UpdateUserRequest ¶
type UpdateUserRequest struct {
// Embedded struct due to allOf(#/components/schemas/UserInfo)
UserInfo `yaml:",inline"`
// previous password
PreviousPassword string `json:"previousPassword"`
}
UpdateUserRequest defines model for UpdateUserRequest.
type UserInfo ¶
type UserInfo struct {
// internal identification id
Id *int `json:"id,omitempty"`
// user email
UserEmail string `json:"userEmail"`
// user id
UserID string `json:"userID"`
// real world name of the user
UserName string `json:"userName"`
// 학번
UserNumber int `json:"userNumber"`
// place holder for user pw
UserPW *string `json:"userPW,omitempty"`
}
UserInfo defines model for UserInfo.