Documentation ¶
Index ¶
- Constants
- Variables
- func APIRoutes(cfn config.Config, trc opentracing.Tracer) (*chi.Mux, error)
- func HealthRoutes(cfn config.Config, tracer opentracing.Tracer) *chi.Mux
- func NewAdrHandler() api.Handler
- type AdrHandler
- func (c *AdrHandler) DeleteAddress(response http.ResponseWriter, request *http.Request)
- func (c *AdrHandler) GetAddress(response http.ResponseWriter, request *http.Request)
- func (c *AdrHandler) GetAddresses(response http.ResponseWriter, request *http.Request)
- func (c *AdrHandler) PostAddress(response http.ResponseWriter, request *http.Request)
- func (c *AdrHandler) Routes() (string, *chi.Mux)
- func (c *AdrHandler) UpdateAddress(response http.ResponseWriter, request *http.Request)
Constants ¶
View Source
const APIVersion = "1"
APIVersion the actual implemented api version
Variables ¶
View Source
var BaseURL = fmt.Sprintf("/api/v%s", APIVersion)
BaseURL is the url all endpoints will be available under
Functions ¶
func HealthRoutes ¶
HealthRoutes returning the health routes
func NewAdrHandler ¶
NewAdrHandler creates a new REST address handler
Types ¶
type AdrHandler ¶
type AdrHandler struct {
// contains filtered or unexported fields
}
AdrHandler the address handler
func (*AdrHandler) DeleteAddress ¶
func (c *AdrHandler) DeleteAddress(response http.ResponseWriter, request *http.Request)
DeleteAddress deleting address
@Summary Delete a address @Tags addresses @Accept json @Produce json @Security api_key @Param tenant header string true "Tenant" @Success 200 "ok" @Failure 400 {object} serror.Serr "client error information as json" @Router /addresses/{id} [delete]
func (*AdrHandler) GetAddress ¶
func (c *AdrHandler) GetAddress(response http.ResponseWriter, request *http.Request)
GetAddress getting one address
@Summary getting one address @Tags addresses @Accept json @Produce json @Security api_key @Param tenant header string true "Tenant" @Param id path string true "ID" @Success 200 {array} pmodel.Address "response with the address with id as json" @Failure 400 {object} serror.Serr "client error information as json" @Failure 500 {object} serror.Serr "server error information as json" @Router /addresses/{id} [get]
func (*AdrHandler) GetAddresses ¶
func (c *AdrHandler) GetAddresses(response http.ResponseWriter, request *http.Request)
GetAddresses getting all addresses
@Summary getting all addresses @Tags addresses @Accept json @Produce json @Security api_key @Param tenant header string true "Tenant" @Success 200 {array} pmodel.Address "response with list of addresses as json" @Failure 400 {object} serror.Serr "client error information as json" @Failure 500 {object} serror.Serr "server error information as json" @Router /addresses [get]
func (*AdrHandler) PostAddress ¶
func (c *AdrHandler) PostAddress(response http.ResponseWriter, request *http.Request)
PostAddress create a new address, this method will always return 201
@Summary Create a new address @Tags addresses @Accept json @Produce json @Security api_key @Param tenant header string true "Tenant" @Param payload body pmodel.Address true "address to be added" @Success 201 {string} string "tenant" @Failure 400 {object} serror.Serr "client error information as json" @Failure 500 {object} serror.Serr "server error information as json" @Router /addresses [post]
func (*AdrHandler) Routes ¶
func (c *AdrHandler) Routes() (string, *chi.Mux)
Routes getting all routes for the address endpoint
func (*AdrHandler) UpdateAddress ¶
func (c *AdrHandler) UpdateAddress(response http.ResponseWriter, request *http.Request)
UpdateAddress update an address, this method will always return 201
@Summary Create a new address @Tags addresses @Accept json @Produce json @Security api_key @Param tenant header string true "Tenant" @Param payload body string true "Add store" @Success 201 {string} string "tenant" @Failure 400 {object} serror.Serr "client error information as json" @Failure 500 {object} serror.Serr "server error information as json" @Router /addresses/{id} [post]
Click to show internal directories.
Click to hide internal directories.