controllers

package
v0.0.0-...-11781d4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 1, 2016 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SessionsOutputValidator

type SessionsOutputValidator interface {
	Output(users []models.Session) []models.Session
}

type Users

type Users struct {
	snakepit.Controller
	Context           *UsersContext
	Inter             UsersInter
	Validator         UsersValidator
	SessionsValidator SessionsOutputValidator
}

func (*Users) Create

func (c *Users) Create(ctx context.Context, w http.ResponseWriter, r *http.Request)

Create swagger:route POST /users Users UsersCreate

Create

Creates one or multiple users in the data source.

Responses:

201: UserResponse

func (*Users) CurrentSession

func (c *Users) CurrentSession(ctx context.Context, w http.ResponseWriter, r *http.Request)

CurrentSession swagger:route GET /users/me/session Users UsersCurrentSession

Current session

Returns the current session.

Responses:

200: SessionResponse

func (*Users) Delete

func (c *Users) Delete(ctx context.Context, w http.ResponseWriter, r *http.Request)

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

func (c *Users) DeleteByKey(ctx context.Context, w http.ResponseWriter, r *http.Request)

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

func (c *Users) Find(ctx context.Context, w http.ResponseWriter, r *http.Request)

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

func (c *Users) FindByKey(ctx context.Context, w http.ResponseWriter, r *http.Request)

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

func (c *Users) Signin(ctx context.Context, w http.ResponseWriter, r *http.Request)

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

func (c *Users) Signout(ctx context.Context, w http.ResponseWriter, r *http.Request)

Signout swagger:route POST /users/me/signout Users UsersSignout

Sign out

Signs out the current user.

Responses:

200: SessionResponse

func (*Users) Signup

func (c *Users) Signup(ctx context.Context, w http.ResponseWriter, r *http.Request)

Signup swagger:route POST /users/signup Users UsersSignup

Sign up

Signs up a user and returns it.

Responses:

201: UserResponse

func (*Users) Update

func (c *Users) Update(ctx context.Context, w http.ResponseWriter, r *http.Request)

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

func (c *Users) UpdateByKey(ctx context.Context, w http.ResponseWriter, r *http.Request)

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

func (c *Users) UpdatePassword(ctx context.Context, w http.ResponseWriter, r *http.Request)

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 UsersContext struct {
	AccessToken    string
	CurrentUser    *models.User
	CurrentSession *models.Session
	Key            string
	Filter         *filters.Filter
}

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
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL