Documentation ¶
Overview ¶
Package rest is responsible for rest communication layer
Package rest is responsible for rest communication layer ¶
Package rest is responsible for rest communication layer ¶
Package rest is responsible for rest communication layer ¶
Package rest is responsible for rest communication layer ¶
Package rest is responsible for rest communication layer ¶
Package rest is responsible for rest communication layer ¶
Package rest is responsible for rest communication layer ¶
Package rest is responsible for rest communication layer ¶
Package rest is responsible for rest communication layer ¶
Package rest is responsible for rest communication layer ¶
Package rest is responsible for rest communication layer ¶
Package rest is responsible for rest communication layer ¶
Package rest is responsible for rest communication layer ¶
Package rest is responsible for rest communication layer ¶
Package rest is responsible for rest communication layer ¶
Package rest is responsible for rest communication layer ¶
Package rest is responsible for rest communication layer
Index ¶
- func CorsHandler(w http.ResponseWriter, r *http.Request)
- func FromJSON(i interface{}, r io.Reader) error
- func NewAPIContext(bindAddress *string, dataContext *application.DataContext) *http.Server
- func ToJSON(i interface{}, w io.Writer) error
- type APIContext
- func (apiContext *APIContext) AddConversation(rw http.ResponseWriter, r *http.Request)
- func (apiContext *APIContext) AddMessage(rw http.ResponseWriter, r *http.Request)
- func (apiContext *APIContext) AddRequest(rw http.ResponseWriter, r *http.Request)
- func (apiContext *APIContext) AddTrip(rw http.ResponseWriter, r *http.Request)
- func (apiContext *APIContext) AddUser(rw http.ResponseWriter, r *http.Request)
- func (apiContext *APIContext) ConfirmUser(rw http.ResponseWriter, r *http.Request)
- func (apiContext *APIContext) GetConversation(rw http.ResponseWriter, r *http.Request)
- func (apiContext *APIContext) GetCountries(rw http.ResponseWriter, r *http.Request)
- func (apiContext *APIContext) GetCountry(rw http.ResponseWriter, r *http.Request)
- func (apiContext *APIContext) GetRequest(rw http.ResponseWriter, r *http.Request)
- func (apiContext *APIContext) GetRequests(rw http.ResponseWriter, r *http.Request)
- func (apiContext *APIContext) GetTrip(rw http.ResponseWriter, r *http.Request)
- func (apiContext *APIContext) GetTrips(rw http.ResponseWriter, r *http.Request)
- func (apiContext *APIContext) GetUser(rw http.ResponseWriter, r *http.Request)
- func (apiContext *APIContext) Index(rw http.ResponseWriter, r *http.Request)
- func (apiContext *APIContext) Live(rw http.ResponseWriter, _ *http.Request)
- func (apiContext *APIContext) Login(w http.ResponseWriter, r *http.Request)
- func (apiContext *APIContext) Ready(rw http.ResponseWriter, _ *http.Request)
- func (apiContext *APIContext) Refresh(w http.ResponseWriter, r *http.Request)
- func (apiContext *APIContext) RelateRequestToTrip(rw http.ResponseWriter, r *http.Request)
- func (apiContext *APIContext) UpdateApproval(rw http.ResponseWriter, r *http.Request)
- func (apiContext *APIContext) Version(rw http.ResponseWriter, r *http.Request)
- type Claims
- type GenericError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CorsHandler ¶
func CorsHandler(w http.ResponseWriter, r *http.Request)
CorsHandler swagger:route OPTIONS /
Handler to respond to CORS preflight requests ¶
Responses:
200: OK
func FromJSON ¶
FromJSON deserializes the object from JSON string in an io.Reader to the given interface
func NewAPIContext ¶
func NewAPIContext(bindAddress *string, dataContext *application.DataContext) *http.Server
NewAPIContext returns a new APIContext handler with the given logger
Types ¶
type APIContext ¶
type APIContext struct {
// contains filtered or unexported fields
}
APIContext struct gathers necessary information for the APIContext
func (*APIContext) AddConversation ¶
func (apiContext *APIContext) AddConversation(rw http.ResponseWriter, r *http.Request)
AddConversation creates a new conversation for a trip.
func (*APIContext) AddMessage ¶
func (apiContext *APIContext) AddMessage(rw http.ResponseWriter, r *http.Request)
AddMessage creates a new message to the conversation.
func (*APIContext) AddRequest ¶
func (apiContext *APIContext) AddRequest(rw http.ResponseWriter, r *http.Request)
AddRequest creates a new request on the system
func (*APIContext) AddTrip ¶
func (apiContext *APIContext) AddTrip(rw http.ResponseWriter, r *http.Request)
AddTrip creates a new trip on the system
func (*APIContext) AddUser ¶
func (apiContext *APIContext) AddUser(rw http.ResponseWriter, r *http.Request)
AddUser creates a new user on the system
func (*APIContext) ConfirmUser ¶
func (apiContext *APIContext) ConfirmUser(rw http.ResponseWriter, r *http.Request)
ConfirmUser confirms a user if found
func (*APIContext) GetConversation ¶
func (apiContext *APIContext) GetConversation(rw http.ResponseWriter, r *http.Request)
GetConversation gets a specific conversation within a trip between the supplier and the requester
func (*APIContext) GetCountries ¶
func (apiContext *APIContext) GetCountries(rw http.ResponseWriter, r *http.Request)
GetCountries gets country list
func (*APIContext) GetCountry ¶
func (apiContext *APIContext) GetCountry(rw http.ResponseWriter, r *http.Request)
GetCountry gets a single country if found
func (*APIContext) GetRequest ¶
func (apiContext *APIContext) GetRequest(rw http.ResponseWriter, r *http.Request)
GetRequest gets a single request based on the id
func (*APIContext) GetRequests ¶
func (apiContext *APIContext) GetRequests(rw http.ResponseWriter, r *http.Request)
GetRequests gets all requests based on the query parameters
func (*APIContext) GetTrip ¶
func (apiContext *APIContext) GetTrip(rw http.ResponseWriter, r *http.Request)
GetTrip Gets a single trip with all the details
func (*APIContext) GetTrips ¶
func (apiContext *APIContext) GetTrips(rw http.ResponseWriter, r *http.Request)
GetTrips gets all the trips within the given country and optionally the given origin and destination
func (*APIContext) GetUser ¶
func (apiContext *APIContext) GetUser(rw http.ResponseWriter, r *http.Request)
GetUser gets a single user if found
func (*APIContext) Index ¶
func (apiContext *APIContext) Index(rw http.ResponseWriter, r *http.Request)
Index returns OK handles GET requests
func (*APIContext) Live ¶
func (apiContext *APIContext) Live(rw http.ResponseWriter, _ *http.Request)
Live handles GET requests
func (*APIContext) Login ¶
func (apiContext *APIContext) Login(w http.ResponseWriter, r *http.Request)
Login handles the login request
func (*APIContext) Ready ¶
func (apiContext *APIContext) Ready(rw http.ResponseWriter, _ *http.Request)
Ready handles GET requests
func (*APIContext) Refresh ¶
func (apiContext *APIContext) Refresh(w http.ResponseWriter, r *http.Request)
Refresh handles the refresh request, and refreshes the validity period of the token
func (*APIContext) RelateRequestToTrip ¶
func (apiContext *APIContext) RelateRequestToTrip(rw http.ResponseWriter, r *http.Request)
RelateRequestToTrip creates a new conversation connecting a request and a trip
func (*APIContext) UpdateApproval ¶
func (apiContext *APIContext) UpdateApproval(rw http.ResponseWriter, r *http.Request)
UpdateApproval updates the approval status of the conversation.
func (*APIContext) Version ¶
func (apiContext *APIContext) Version(rw http.ResponseWriter, r *http.Request)
Version returns the version info for the service by reading from a static file
type Claims ¶
type Claims struct { UserID string `json:"userid"` UserName string `json:"username"` Payload jwt.RegisteredClaims `json:"payload"` }
Claims represents the data for a user login
type GenericError ¶
type GenericError struct {
Message string `json:"message"`
}
GenericError is a generic error message returned by a server
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package dto is the package that defines types for data transfer
|
Package dto is the package that defines types for data transfer |
Package errors contains the generic errors for the REST adapter
|
Package errors contains the generic errors for the REST adapter |
Package mappers is the package that maps objects back and fort between dto and domain
|
Package mappers is the package that maps objects back and fort between dto and domain |
Package middleware is the package that holds the middleware logict for rest layer
|
Package middleware is the package that holds the middleware logict for rest layer |