endpoint

package
v0.0.0-...-f0f63f4 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetupLogin

func SetupLogin(c Core)

SetupLogin .

func SetupNotepad

func SetupNotepad(c Core)

SetupNotepad .

func SetupRegister

func SetupRegister(core Core)

SetupRegister .

func SetupStatic

func SetupStatic(core Core)

SetupStatic .

Types

type Core

type Core struct {
	Log      logger.ILog
	Router   *router.Mux
	Bind     api.IBind
	Response api.IResponse
	Token    api.IToken
	Password api.IPassword
	Store    *store.Factory
	Context  api.IContext
}

Core represents the core for all the endpoints.

func NewCore

func NewCore(l logger.ILog,
	mux *router.Mux,
	bind api.IBind,
	resp api.IResponse,
	token api.IToken,
	pass api.IPassword,
	storeFactory *store.Factory,
	ctx api.IContext) Core

NewCore returns a core for all the endpoints.

type LoginEndpoint

type LoginEndpoint struct {
	Core
}

LoginEndpoint .

func (*LoginEndpoint) Login

func (p *LoginEndpoint) Login(w http.ResponseWriter, r *http.Request) (int, error)

Login . swagger:route POST /api/v1/login authentication UserLogin

Authenticate a user.

Responses:

200: LoginResponse
400: BadRequestResponse
500: InternalServerErrorResponse

type NoteEndpoint

type NoteEndpoint struct {
	Core
}

NoteEndpoint .

func (*NoteEndpoint) Create

func (p *NoteEndpoint) Create(w http.ResponseWriter, r *http.Request) (int, error)

Create . swagger:route POST /api/v1/note note NoteCreate

Create a note.

Security:

token:

Responses:

201: CreatedResponse
400: BadRequestResponse
401: UnauthorizedResponse
500: InternalServerErrorResponse

func (NoteEndpoint) Destroy

func (p NoteEndpoint) Destroy(w http.ResponseWriter, r *http.Request) (int, error)

Destroy . swagger:route DELETE /api/v1/note/{note_id} note NoteDestroy

Delete a note.

Security:

token:

Responses:

200: OKResponse
400: BadRequestResponse
401: UnauthorizedResponse
500: InternalServerErrorResponse

func (NoteEndpoint) Index

func (p NoteEndpoint) Index(w http.ResponseWriter, r *http.Request) (int, error)

Index . swagger:route GET /api/v1/note note NoteIndex

List notes.

Security:

token:

Responses:

200: NoteIndexResponse
400: BadRequestResponse
401: UnauthorizedResponse
500: InternalServerErrorResponse

func (NoteEndpoint) Show

Show . swagger:route GET /api/v1/note/{note_id} note NoteShow

Show a note.

Security:

token:

Responses:

200: NoteShowResponse
400: BadRequestResponse
401: UnauthorizedResponse
500: InternalServerErrorResponse

func (*NoteEndpoint) Update

func (p *NoteEndpoint) Update(w http.ResponseWriter, r *http.Request) (int, error)

Update . swagger:route PUT /api/v1/note/{note_id} note NoteUpdate

Update a note.

Security:

token:

Responses:

200: OKResponse
400: BadRequestResponse
401: UnauthorizedResponse
500: InternalServerErrorResponse

type RegisterEndpoint

type RegisterEndpoint struct {
	Core
}

RegisterEndpoint .

func (*RegisterEndpoint) Register

func (p *RegisterEndpoint) Register(w http.ResponseWriter, r *http.Request) (int, error)

Register . swagger:route POST /api/v1/register authentication UserRegister

Register a user.

Responses:

201: CreatedResponse
400: BadRequestResponse
500: InternalServerErrorResponse

type StaticEndpoint

type StaticEndpoint struct {
	Core
}

StaticEndpoint .

func (StaticEndpoint) Index

Index . swagger:route GET /api/v1 healthcheck Ready

API is ready.

Responses:

200: OKResponse

func (StaticEndpoint) Static

func (p StaticEndpoint) Static(w http.ResponseWriter, r *http.Request) (int, error)

Static .

Jump to

Keyboard shortcuts

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