Documentation ¶
Index ¶
- type SessionsOutputValidator
- type Users
- func (c *Users) Create(ctx context.Context, w http.ResponseWriter, r *http.Request)
- func (c *Users) CurrentSession(ctx context.Context, w http.ResponseWriter, r *http.Request)
- func (c *Users) Delete(ctx context.Context, w http.ResponseWriter, r *http.Request)
- func (c *Users) DeleteByKey(ctx context.Context, w http.ResponseWriter, r *http.Request)
- func (c *Users) Find(ctx context.Context, w http.ResponseWriter, r *http.Request)
- func (c *Users) FindByKey(ctx context.Context, w http.ResponseWriter, r *http.Request)
- func (c *Users) Signin(ctx context.Context, w http.ResponseWriter, r *http.Request)
- func (c *Users) Signout(ctx context.Context, w http.ResponseWriter, r *http.Request)
- func (c *Users) Signup(ctx context.Context, w http.ResponseWriter, r *http.Request)
- func (c *Users) Update(ctx context.Context, w http.ResponseWriter, r *http.Request)
- func (c *Users) UpdateByKey(ctx context.Context, w http.ResponseWriter, r *http.Request)
- func (c *Users) UpdatePassword(ctx context.Context, w http.ResponseWriter, r *http.Request)
- type UsersContext
- type UsersInter
- type UsersValidator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SessionsOutputValidator ¶
type Users ¶
type Users struct { snakepit.Controller Context *UsersContext Inter UsersInter Validator UsersValidator SessionsValidator SessionsOutputValidator }
func NewUsers ¶
func NewUsers( c *viper.Viper, l *logrus.Entry, j *snakepit.JSON, ctx *UsersContext, i UsersInter, v UsersValidator, sv SessionsOutputValidator, ) *Users
func (*Users) Create ¶
Create swagger:route POST /users Users UsersCreate
Create ¶
Creates one or multiple users in the data source.
Responses:
201: UserResponse
func (*Users) CurrentSession ¶
CurrentSession swagger:route GET /users/me/session Users UsersCurrentSession
Current session ¶
Returns the current session.
Responses:
200: SessionResponse
func (*Users) Delete ¶
Delete swagger:route DELETE /users Users UsersDelete
Delete ¶
Deletes all the users matched by filter in the data source.
Responses:
200: UsersResponse
func (*Users) DeleteByKey ¶
DeleteByKey swagger:route DELETE /users/{key} Users UsersDeleteByKey
Delete by key ¶
Deletes a user by key in the data source.
Responses:
200: UserResponse
func (*Users) Find ¶
Find swagger:route GET /users Users UsersFind
Find ¶
Finds all the users matched by filter from the data source.
Responses:
200: UsersResponse
func (*Users) FindByKey ¶
FindByKey swagger:route GET /users/{key} Users UsersFindByKey
Find by key ¶
Finds a user by key from the data source.
Responses:
200: UserResponse
func (*Users) Signin ¶
Signin swagger:route POST /users/signin Users UsersSignin
Sign in ¶
Signs in a user and returns a new session.
Responses:
201: SessionResponse
func (*Users) Signout ¶
Signout swagger:route POST /users/me/signout Users UsersSignout
Sign out ¶
Signs out the current user.
Responses:
200: SessionResponse
func (*Users) Signup ¶
Signup swagger:route POST /users/signup Users UsersSignup
Sign up ¶
Signs up a user and returns it.
Responses:
201: UserResponse
func (*Users) Update ¶
Update swagger:route PUT /users Users UsersUpdate
Update ¶
Updates all the users matched by filter in the data source.
Responses:
200: UserResponse
func (*Users) UpdateByKey ¶
UpdateByKey swagger:route PUT /users/{key} Users UsersUpdateByKey
Update by key ¶
Updates a user by key in the data source.
Responses:
200: UserResponse
func (*Users) UpdatePassword ¶
UpdatePassword swagger:route POST /users/{key}/password Users UsersUpdatePassword
Update password ¶
Updates the user password in the data source.
Responses:
200: UserResponse
type UsersContext ¶
type UsersInter ¶
type UsersInter interface { Create(users []models.User) ([]models.User, error) Find(f *filters.Filter) ([]models.User, error) Update(user *models.User, f *filters.Filter) ([]models.User, error) Delete(f *filters.Filter) ([]models.User, error) FindByKey(key string, f *filters.Filter) (*models.User, error) UpdateByKey(key string, user *models.User) (*models.User, error) DeleteByKey(key string) (*models.User, error) Signup(user *models.User) (*models.User, error) Signin(cred *models.Credentials, agent string) (*models.Session, error) Signout(accessToken string) (*models.Session, error) UpdatePassword(key, password string) (*models.User, error) }
type UsersValidator ¶
type UsersValidator interface { Signin(cred *models.Credentials) (*models.Credentials, error) Signup(user *models.User) (*models.User, error) Create(users []models.User) ([]models.User, error) Update(user *models.User) (*models.User, error) UpdatePassword(pwd *models.Password) (*models.Password, error) Output(users []models.User) []models.User }