handlers

package
v0.0.0-...-6417433 Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2022 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckIsTrackCached

func CheckIsTrackCached(w http.ResponseWriter, r *http.Request)

CheckIsTrackCached godoc @Summary Check cached status of a given track in the database. Warning: Intensive operation @Description Determine whether, given a particular track ID and a route, if the track is cached in the database @Tags cached @Produce json @Param track_id path string true "Track ID (letter from A-Z)" @Param route query string true "Route string as returned by other API requests (POINT XX/XX XX/XX ...)" Success 200 {object} RequestOK "If the track has been found, the TMI will be returned in the OK object message" Failure 404 {object} NotFound Failure 500 {object} InternalServerError @Failure 501 {object} NotImplemented @Router /cached/check/{track_id} [get]

func DeleteEventTrack

func DeleteEventTrack(w http.ResponseWriter, r *http.Request)

DELETE /event/{track_id}

func DeleteFix

func DeleteFix(w http.ResponseWriter, r *http.Request)

DELETE /fixes/{fix_name}

func GetAllConcordeTracks

func GetAllConcordeTracks(w http.ResponseWriter, r *http.Request)

GetAllConcordeTracks godoc @Summary Get all concorde tracks @Description JSON output of all concorde tracks available for use @Tags concorde @Produce json @Success 200 {array} models.Track @Failure 500 {object} InternalServerError @Router /concorde [get]

func GetAllCurrentTracks

func GetAllCurrentTracks(w http.ResponseWriter, r *http.Request)

GetAllCurrentTracks godoc @Summary Get all current tracks @Description JSON output of all tracks published in the current NAT message @Tags current @Produce json @Param si query boolean false "Parse altitudes in metres" @Success 200 {array} models.Track @Failure 500 {object} InternalServerError @Router /current [get]

func GetAllEventTracks

func GetAllEventTracks(w http.ResponseWriter, r *http.Request)

GetAllEventTracks godoc @Summary Get all event tracks with a given TMI @Description JSON output of all event tracks per an assigned TMI @Tags event @Produce json @Param event_tmi path string true "The TMI assigned to the event" @Success 200 {array} models.Track @Failure 404 {object} NotFound @Failure 500 {object} InternalServerError @Router /event/{event_tmi} [get]

func GetAllFixes

func GetAllFixes(w http.ResponseWriter, r *http.Request)

GetAllFixes godoc @Summary Get all stored fixes @Description JSON output of all fixes stored in the API database @Tags fixes @Produce json @Success 200 {array} models.Fix @Failure 500 {object} InternalServerError @Router /fixes [get]

func GetCachedEastboundTracks

func GetCachedEastboundTracks(w http.ResponseWriter, r *http.Request)

GetCachedEastboundTracks godoc @Summary Get all cached eastbound tracks with a given TMI @Description JSON output of all cached eastbound tracks with the requested TMI @Tags cached @Produce json @Param tmi path string true "Track Message Identifier (Julian calendar day numbered 1 to 365, incl. any amendment characters)" @Success 200 {array} models.Track @Failure 404 {object} NotFound @Failure 500 {object} InternalServerError @Router /cached/eastbound/{tmi} [get]

func GetCachedTrack

func GetCachedTrack(w http.ResponseWriter, r *http.Request)

GetCachedTrack godoc @Summary Get one cached track by ID and TMI @Description JSON output of a specific track cached in the API database @Tags cached @Produce json @Param tmi path string true "Track Message Identifier (Julian calendar day numbered 1 to 365, incl. any amendment characters)" @Param track_id path string true "Track ID (letter from A-Z)" @Success 200 {object} models.Track @Failure 404 {object} NotFound @Failure 500 {object} InternalServerError @Router /cached/{tmi}/{track_id} [get]

func GetCachedTracks

func GetCachedTracks(w http.ResponseWriter, r *http.Request)

GetCachedTracks godoc @Summary Get all cached tracks with a given TMI @Description JSON output of all cached tracks with the requested TMI @Tags cached @Produce json @Param tmi path string true "Track Message Identifier (Julian calendar day numbered 1 to 365, incl. any amendment characters)" @Success 200 {array} models.Track @Failure 404 {object} NotFound @Failure 500 {object} InternalServerError @Router /cached/{tmi} [get]

func GetCachedWestboundTracks

func GetCachedWestboundTracks(w http.ResponseWriter, r *http.Request)

GetCachedWestboundTracks godoc @Summary Get all cached westbound tracks with a given TMI @Description JSON output of all cached westbound tracks with the requested TMI @Tags cached @Produce json @Param tmi path string true "Track Message Identifier (Julian calendar day numbered 1 to 365, incl. any amendment characters)" @Success 200 {array} models.Track @Failure 404 {object} NotFound @Failure 500 {object} InternalServerError @Router /cached/westbound/{tmi} [get]

func GetConcordeFixes

func GetConcordeFixes(w http.ResponseWriter, r *http.Request)

GetConcordeFixes godoc @Summary Get all stored Concorde fixes @Description JSON output of all Concorde fixes stored in the API database @Tags fixes @Produce json @Success 200 {array} models.Fix @Failure 500 {object} InternalServerError @Router /fixes/concorde [get]

func GetConcordeTrack

func GetConcordeTrack(w http.ResponseWriter, r *http.Request)

GetConcordeTrack godoc @Summary Get one concorde track @Description JSON output of one specific concorde track @Tags concorde @Produce json @Param track_id path string true "SM, SN, SO or SP" @Success 200 {object} models.Track @Failure 404 {object} NotFound @Failure 500 {object} InternalServerError @Router /concorde/{track_id} [get]

func GetCurrentEastboundTracks

func GetCurrentEastboundTracks(w http.ResponseWriter, r *http.Request)

GetCurrentEastboundTracks godoc @Summary Get all currently published eastbound tracks @Description JSON output of all eastbound tracks currently listed in the NAT message @Tags current @Produce json @Param si query boolean false "Parse altitudes in metres" @Success 200 {array} models.Track @Failure 404 {object} NotFound @Failure 500 {object} InternalServerError @Router /current/eastbound [get]

func GetCurrentTMI

func GetCurrentTMI(w http.ResponseWriter, r *http.Request)

GetCurrentTMI godoc @Summary Get the current TMI @Description String output of the current TMI @Tags current @Produce json @Success 200 {object} string @Failure 500 {object} InternalServerError @Router /current/tmi [get]

func GetCurrentTrack

func GetCurrentTrack(w http.ResponseWriter, r *http.Request)

GetCurrentTrack godoc @Summary Get one current track by ID @Description JSON output of a specific track published in the current NAT message @Tags current @Produce json @Param track_id path string true "Track ID (letter from A-Z)" @Param si query boolean false "Parse altitudes in metres" @Success 200 {object} models.Track @Failure 404 {object} NotFound @Failure 500 {object} InternalServerError @Router /current/{track_id} [get]

func GetCurrentTracksValidEarlier

func GetCurrentTracksValidEarlier(w http.ResponseWriter, r *http.Request)

GetCurrentTracksValidEarlier godoc @Summary Get all currently published tracks valid earlier @Description JSON output of all tracks currently listed in the NAT message which are valid earlier @Tags current @Produce json @Param si query boolean false "Parse altitudes in metres" @Success 200 {array} models.Track @Failure 404 {object} NotFound @Failure 500 {object} InternalServerError @Router /current/earlier [get]

func GetCurrentTracksValidLater

func GetCurrentTracksValidLater(w http.ResponseWriter, r *http.Request)

GetCurrentTracksValidLater godoc @Summary Get all currently published tracks valid later @Description JSON output of all tracks currently listed in the NAT message which are valid later @Tags current @Produce json @Param si query boolean false "Parse altitudes in metres" @Success 200 {array} models.Track @Failure 404 {object} NotFound @Failure 500 {object} InternalServerError @Router /current/later [get]

func GetCurrentTracksValidNow

func GetCurrentTracksValidNow(w http.ResponseWriter, r *http.Request)

GetCurrentTracksValidNow godoc @Summary Get all currently published tracks valid now @Description JSON output of all tracks currently listed in the NAT message which are valid now @Tags current @Produce json @Param si query boolean false "Parse altitudes in metres" @Success 200 {array} models.Track @Failure 404 {object} NotFound @Failure 500 {object} InternalServerError @Router /current/now [get]

func GetCurrentWestboundTracks

func GetCurrentWestboundTracks(w http.ResponseWriter, r *http.Request)

GetCurrentWestboundTracks godoc @Summary Get all currently published westbound tracks @Description JSON output of all westbound tracks currently listed in the NAT message @Tags current @Produce json @Param si query boolean false "Parse altitudes in metres" @Success 200 {array} models.Track @Failure 404 {object} NotFound @Failure 500 {object} InternalServerError @Router /current/westbound [get]

func GetEventTrack

func GetEventTrack(w http.ResponseWriter, r *http.Request)

GetEventTrack godoc @Summary Get one event track @Description JSON output of a specific event track per an assigned TMI and its ID @Tags event @Produce json @Param event_tmi path string true "The TMI assigned to the event" @Param track_id path string true "The requested track ID" @Success 200 {object} models.Track @Failure 404 {object} NotFound @Failure 500 {object} InternalServerError @Router /event/{event_tmi}/{track_id} [get]

func GetFix

func GetFix(w http.ResponseWriter, r *http.Request)

GetFix godoc @Summary Get one stored fix @Description JSON output of one specific fix stored in the API database @Tags fixes @Produce json @Param fix_name path string true "The name of the fix" @Success 200 {array} models.Fix @Failure 404 {object} NotFound @Failure 500 {object} InternalServerError @Router /fixes/{fix_name} [get]

func ListCachedTMIs

func ListCachedTMIs(w http.ResponseWriter, r *http.Request)

ListCachedTMIs godoc @Summary List the TMIs cached in the database @Description JSON array of all TMIs cached in the database @Tags cached @Produce json @Success 200 {array} string @Failure 500 {object} InternalServerError @Router /cached/tmis [get]

func PostEventTrack

func PostEventTrack(w http.ResponseWriter, r *http.Request)

POST /event/{track_obj}

func PostFix

func PostFix(w http.ResponseWriter, r *http.Request)

TODO Errors, docs and auth for POST/PUT/DELETE POST /fixes

func PutEventTrack

func PutEventTrack(w http.ResponseWriter, r *http.Request)

PUT /event/{track_obj}

func PutFix

func PutFix(w http.ResponseWriter, r *http.Request)

PUT /fixes

Types

type BadRequest

type BadRequest struct {
	Code    int    `json:"Code" example:"400"`
	Message string `json:"Message" example:"Unable to process request."`
}

Code 400 Bad Request

func Error400

func Error400(w *http.ResponseWriter, msg string) BadRequest

type Forbidden

type Forbidden struct {
	Code    int    `json:"Code" example:"403"`
	Message string `json:"Message" example:"Access to the requested resource is forbidden."`
}

Code 403 Forbidden

func Error403

func Error403(w *http.ResponseWriter, msg string) Forbidden

type InternalServerError

type InternalServerError struct {
	Code    int    `json:"Code" example:"500"`
	Message string `json:"Message" example:"A server error occurred. Please try again later."`
}

Code 500 Internal Server Error

type NotFound

type NotFound struct {
	Code    int    `json:"Code" example:"404"`
	Message string `json:"Message" example:"The requested resource was not found."`
}

Code 404 Not Found

func Error404

func Error404(w *http.ResponseWriter, msg string) NotFound

type NotImplemented

type NotImplemented struct {
	Code    int    `json:"Code" example:"501"`
	Message string `json:"Message" example:"This operation has not yet been implemented."`
}

Code 501 Not Implemented

func Error501

func Error501(w *http.ResponseWriter, msg string) NotImplemented

type RequestOK

type RequestOK struct {
	Code    int    `json:"Code" example:"200"`
	Message string `json:"Message" example:"Request succeeded."`
}

Code 200 Success

func Success200

func Success200(w *http.ResponseWriter, msg string) RequestOK

Jump to

Keyboard shortcuts

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