apiv1

package
v0.0.0-...-215ad9e Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2024 License: Apache-2.0 Imports: 26 Imported by: 0

Documentation

Index

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 APIRoutes

func APIRoutes(cfn config.Config, trc opentracing.Tracer) (*chi.Mux, error)

APIRoutes configuring the api routes for the main REST API

func HealthRoutes

func HealthRoutes(cfn config.Config, tracer opentracing.Tracer) *chi.Mux

HealthRoutes returning the health routes

func NewAdrHandler

func NewAdrHandler() api.Handler

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]

Jump to

Keyboard shortcuts

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