proto

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2020 License: GPL-3.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAliasAlreadyExist = echo.NewHTTPError(409, "alias already exist")

ErrAliasAlreadyExist is returned when user already own the wanted alias

View Source
var ErrAliasNotFound = echo.NewHTTPError(404, "alias not found")

ErrAliasNotFound is returned when the wanted alias cannot be found

View Source
var ErrAliasTaken = echo.NewHTTPError(409, "alias already taken")

ErrAliasTaken is returned when the wanted alias is already taken by someone else

View Source
var ErrDomainNotFound = echo.NewHTTPError(404, "requested domain not found")

ErrDomainNotFound is returned when the alias to register use non supported / not existing domain

View Source
var ErrInvalidParameters = echo.NewHTTPError(400, "invalid request parameter(s)")

ErrInvalidParameters is returned when the given request is invalid

Functions

This section is empty.

Types

type APIContract

type APIContract interface {
	// Authenticate user using given credential
	// this either return the JWT token or an error if something goes wrong
	// POST /sessions
	Authenticate(cred CredentialsDto) (TokenDto, error)
	// GetAliases return user current aliases
	// GET /aliases
	GetAliases(token TokenDto) ([]AliasDto, error)
	// RegisterAlias register a new alias for the user
	// POST /aliases
	RegisterAlias(token TokenDto, alias AliasDto) (AliasDto, error)
	// UpdateAlias update the user existing alias
	// PUT /aliases/{name}
	UpdateAlias(token TokenDto, alias AliasDto) (AliasDto, error)
	// DeleteAlias delete the user given alias
	// DELETE /aliases/{name}
	DeleteAlias(token TokenDto, name string) error

	// GetDomains return the list of available / supported domains
	// for alias creation
	// GET /domains
	GetDomains(token TokenDto) ([]DomainDto, error)
}

APIContract defined the API served by the Daemon

type AliasDto

type AliasDto struct {
	Domain string `json:"domain"`
	Value  string `json:"value"`
}

AliasDto represent a DyDNS alias

type CredentialsDto

type CredentialsDto struct {
	Email    string `json:"email"`
	Password string `json:"password"`
}

CredentialsDto represent the credentials when issuing a authentication request

type DomainDto

type DomainDto struct {
	Domain string `json:"domain"`
}

DomainDto represent a domain usable to create alias on the Daemon

type ErrorDto

type ErrorDto struct {
	Message string `json:"message"`
}

ErrorDto is the generic error response in case of API error TODO make my own error mapper

func (ErrorDto) Error

func (e ErrorDto) Error() string

type TokenDto

type TokenDto struct {
	Token string `json:"token"`
}

TokenDto represent the object that encapsulate the JWT token when issuing a authentication request

type UserContext

type UserContext struct {
	UserID uint
}

UserContext represent the JWT token payload and identify the logged in user in secured endpoints

Jump to

Keyboard shortcuts

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