timeendpoint

package
v0.0.0-...-4d2825e Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrValidation

func ErrValidation(err error) error

Types

type AddDayRequest

type AddDayRequest struct {
	ListID  int `validate:"gte=0"`
	Date    time.Time
	Moments []timeservice.Moment `validate:"gt=0"`
}

AddDay(ctx context.Context, listID int, date time.Time, moments []Moment) (Day, error)

type AddDayResponse

type AddDayResponse struct {
	Day *timeservice.Day `json:"day"`
	Err error            `json:"-"`
}

func (AddDayResponse) Failed

func (r AddDayResponse) Failed() error

type AddListRequest

type AddListRequest struct {
	Name     string `validate:"required"`
	Settings *timeservice.ListSettings
}

lists AddList(ctx context.Context, name string, settings ListSettings) (List, error)

type AddListResponse

type AddListResponse struct {
	List *timeservice.List `json:"list"`
	Err  error             `json:"-"`
}

func (AddListResponse) Failed

func (r AddListResponse) Failed() error

type DeleteDayRequest

type DeleteDayRequest struct {
	ListID int `validate:"gte=0"`
	Date   time.Time
}

DeleteDay(ctx context.Context, listID int, date time.Time) error

type DeleteDayResponse

type DeleteDayResponse struct {
	Err error `json:"-"`
}

func (DeleteDayResponse) Failed

func (r DeleteDayResponse) Failed() error

type DeleteListRequest

type DeleteListRequest struct {
	ListID int `validate:"gte=0"`
}

DeleteList(ctx context.Context, listID int) error

type DeleteListResponse

type DeleteListResponse struct {
	Err error `json:"-"`
}

func (DeleteListResponse) Failed

func (r DeleteListResponse) Failed() error

type GetDayRequest

type GetDayRequest struct {
	ListID int `validate:"gte=0"`
	Date   time.Time
}

GetDay(ctx context.Context, listID int, date time.Time) (Day, error)

type GetDayResponse

type GetDayResponse struct {
	Day *timeservice.Day `json:"day"`
	Err error            `json:"-"`
}

func (GetDayResponse) Failed

func (r GetDayResponse) Failed() error

type GetDaysRequest

type GetDaysRequest struct {
	ListID int `validate:"gte=0"`
}

GetDays(ctx context.Context, listID int, opts ...ListDaysOption) ([]Day, error)

type GetDaysResponse

type GetDaysResponse struct {
	Days []timeservice.Day `json:"days"`
	Err  error             `json:"-"`
}

func (GetDaysResponse) Failed

func (r GetDaysResponse) Failed() error

type GetListRequest

type GetListRequest struct {
	ListID int `validate:"gte=0"`
}

GetList(ctx context.Context, listID int) (List, error)

type GetListResponse

type GetListResponse struct {
	List *timeservice.List `json:"list"`
	Err  error             `json:"-"`
}

func (GetListResponse) Failed

func (r GetListResponse) Failed() error

type GetListsRequest

type GetListsRequest struct{}

GetLists(ctx context.Context) ([]List, error)

type GetListsResponse

type GetListsResponse struct {
	List []timeservice.List `json:"lists"`
	Err  error              `json:"-"`
}

func (GetListsResponse) Failed

func (r GetListsResponse) Failed() error

type Set

type Set struct {
	AddList    endpoint.Endpoint
	GetLists   endpoint.Endpoint
	GetList    endpoint.Endpoint
	UpdateList endpoint.Endpoint
	DeleteList endpoint.Endpoint
	AddDay     endpoint.Endpoint
	GetDays    endpoint.Endpoint
	GetDay     endpoint.Endpoint
	UpdateDay  endpoint.Endpoint
	DeleteDay  endpoint.Endpoint
}

Set collects all of the endpoints that compose an add service. It's meant to be used as a helper struct, to collect all of the endpoints into a single parameter.

func New

func New(svc timeservice.Service) Set

New returns a Set that wraps the provided server, and wires in all of the expected endpoint middlewares via the various parameters.

type UpdateDayRequest

type UpdateDayRequest struct {
	ListID  int `validate:"gte=0"`
	Date    time.Time
	Moments []timeservice.Moment
}

UpdateDay(ctx context.Context, listID int, date time.Time, moments []Moment) (Day, error)

type UpdateDayResponse

type UpdateDayResponse struct {
	Days *timeservice.Day `json:"days"`
	Err  error            `json:"-"`
}

func (UpdateDayResponse) Failed

func (r UpdateDayResponse) Failed() error

type UpdateListRequest

type UpdateListRequest struct {
	ListID   int `validate:"gte=0"`
	Name     string
	Settings *timeservice.ListSettings
}

UpdateList(ctx context.Context, listID int, settings ListSettings) (List, error)

type UpdateListResponse

type UpdateListResponse struct {
	List *timeservice.List `json:"list"`
	Err  error             `json:"-"`
}

func (UpdateListResponse) Failed

func (r UpdateListResponse) Failed() error

type ValidationErr

type ValidationErr struct {
	Err error
}

func (*ValidationErr) Error

func (e *ValidationErr) Error() string

func (*ValidationErr) Unwrap

func (e *ValidationErr) Unwrap() error

Jump to

Keyboard shortcuts

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