endpoint

package
v0.0.0-...-08046e1 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2018 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandlerFor

func HandlerFor(
	name EndPtName,
) func(
	http.ResponseWriter,
	*http.Request,
)

HandlerFor returns an handler for the given endpoint name.

func ValidateEmail

func ValidateEmail(
	ctx context.Context,
	email string,
) (*string, error)

ValidateEmail vlaidates an email address.

func ValidateUsername

func ValidateUsername(
	ctx context.Context,
	username string,
) (*string, error)

ValidateUsername vlaidates an email address.

Types

type CreateUser

type CreateUser struct {
	Username string
	Email    string
}

CreateUser a new user by username and email and send its secret over eail.

func (*CreateUser) Execute

func (e *CreateUser) Execute(
	ctx context.Context,
) (*int, *svc.Resp, error)

Execute executes the endpoint.

func (*CreateUser) Validate

func (e *CreateUser) Validate(
	r *http.Request,
) error

Validate validates the input parameters.

type EmailData

type EmailData struct {
	Env      string
	From     string
	Username string
	Email    string
	Mint     string
	CredsURL string
	Secret   string
}

EmailData is the data required to execute the email template.

type EndPtName

type EndPtName string

EndPtName reprensents an endpoint name.

const (
	// EndPtCreateUser creates a new offer.
	EndPtCreateUser EndPtName = "CreateUser"
)
const (
	// EndPtRetrieveUser creates a new offer.
	EndPtRetrieveUser EndPtName = "RetrieveUser"
)
const (
	// EndPtRollUser rolls a user password.
	EndPtRollUser EndPtName = "RollUser"
)

type Endpoint

type Endpoint interface {
	Validate(
		r *http.Request,
	) error

	Execute(
		ctx context.Context,
	) (*int, *svc.Resp, error)
}

Endpoint is the interface that endpoints need to implement.

func NewCreateUser

func NewCreateUser(
	r *http.Request,
) (Endpoint, error)

NewCreateUser constructs and initialiezes the endpoint.

func NewRetrieveUser

func NewRetrieveUser(
	r *http.Request,
) (Endpoint, error)

NewRetrieveUser constructs and initialiezes the endpoint.

func NewRollUser

func NewRollUser(
	r *http.Request,
) (Endpoint, error)

NewRollUser constructs and initialiezes the endpoint.

type RetrieveUser

type RetrieveUser struct {
	Username string
	Secret   string
}

RetrieveUser a new user by username and email and send its secret over eail.

func (*RetrieveUser) Execute

func (e *RetrieveUser) Execute(
	ctx context.Context,
) (*int, *svc.Resp, error)

Execute executes the endpoint.

func (*RetrieveUser) Validate

func (e *RetrieveUser) Validate(
	r *http.Request,
) error

Validate validates the input parameters.

type RollUser

type RollUser struct {
	Username string
	Secret   string
}

RollUser a new user by username and email and send its secret over eail.

func (*RollUser) Execute

func (e *RollUser) Execute(
	ctx context.Context,
) (*int, *svc.Resp, error)

Execute executes the endpoint.

func (*RollUser) Validate

func (e *RollUser) Validate(
	r *http.Request,
) error

Validate validates the input parameters.

Jump to

Keyboard shortcuts

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