Documentation ¶
Index ¶
- Constants
- type GithubUser
- type JsonReturnError
- type ShortLink
- type ShortlinkController
- func (s *ShortlinkController) HandleCreateShortLink(ct *gin.Context)
- func (s *ShortlinkController) HandleDeleteShortLink(ct *gin.Context)
- func (s *ShortlinkController) HandleGetShortLink(ct *gin.Context)
- func (s *ShortlinkController) HandleListShortLink(ct *gin.Context)
- func (s *ShortlinkController) HandleShortLink(ct *gin.Context)
- func (s *ShortlinkController) HandleUpdateShortLink(ct *gin.Context)
Constants ¶
const ( ContentTypeApplicationJSON = "application/json" ContentTypeTextPlain = "text/plain" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GithubUser ¶
type JsonReturnError ¶
type ShortLink ¶
type ShortLink struct { Name string `json:"name"` Spec v1alpha1.ShortLinkSpec `json:"spec,omitempty"` Status v1alpha1.ShortLinkStatus `json:"status,omitempty"` }
type ShortlinkController ¶
type ShortlinkController struct {
// contains filtered or unexported fields
}
ShortlinkController is an object who handles the requests made towards our shortlink-application
func NewShortlinkController ¶
func NewShortlinkController(tracer trace.Tracer, client *shortlinkClient.ShortlinkClient) *ShortlinkController
NewShortlinkController creates a new ShortlinkController
func (*ShortlinkController) HandleCreateShortLink ¶
func (s *ShortlinkController) HandleCreateShortLink(ct *gin.Context)
HandleCreateShortLink handles the creation of a shortlink and redirects according to the configuration @BasePath /api/v1/ @Summary create new shortlink @Schemes http https @Description create a new shortlink @Accept application/json @Produce text/plain @Produce application/json @Param shortlink path string false "the shortlink URL part (shortlink id)" example(home) @Param spec body v1alpha1.ShortLinkSpec true "shortlink spec" @Success 200 {object} int "Success" @Success 301 {object} int "MovedPermanently" @Success 302 {object} int "Found" @Success 307 {object} int "TemporaryRedirect" @Success 308 {object} int "PermanentRedirect" @Failure 401 {object} int "Unauthorized" @Failure 404 {object} int "NotFound" @Failure 500 {object} int "InternalServerError" @Tags api/v1/ @Router /api/v1/shortlink/{shortlink} [post] @Security bearerAuth
func (*ShortlinkController) HandleDeleteShortLink ¶
func (s *ShortlinkController) HandleDeleteShortLink(ct *gin.Context)
HandleDeleteShortLink handles the deletion of a shortlink @BasePath /api/v1/ @Summary delete shortlink @Schemes http https @Description delete shortlink @Produce text/plain @Produce application/json @Param shortlink path string true "the shortlink URL part (shortlink id)" example(home) @Success 200 {object} int "Success" @Failure 401 {object} int "Unauthorized" @Failure 404 {object} int "NotFound" @Failure 500 {object} int "InternalServerError" @Tags api/v1/ @Router /api/v1/shortlink/{shortlink} [delete] @Security bearerAuth
func (*ShortlinkController) HandleGetShortLink ¶
func (s *ShortlinkController) HandleGetShortLink(ct *gin.Context)
HandleGetShortLink returns the shortlink @BasePath /api/v1/ @Summary get a shortlink @Schemes http https @Description get a shortlink @Produce text/plain @Produce application/json @Param shortlink path string false "the shortlink URL part (shortlink id)" example(home) @Success 200 {object} ShortLink "Success" @Failure 401 {object} int "Unauthorized" @Failure 404 {object} int "NotFound" @Failure 500 {object} int "InternalServerError" @Tags api/v1/ @Router /api/v1/shortlink/{shortlink} [get] @Security bearerAuth
func (*ShortlinkController) HandleListShortLink ¶
func (s *ShortlinkController) HandleListShortLink(ct *gin.Context)
HandleListShortLink handles the listing of @BasePath /api/v1/ @Summary list shortlinks @Schemes http https @Description list shortlinks @Produce text/plain @Produce application/json @Success 200 {object} []ShortLink "Success" @Failure 401 {object} int "Unauthorized" @Failure 404 {object} int "NotFound" @Failure 500 {object} int "InternalServerError" @Tags api/v1/ @Router /api/v1/shortlink/ [get] @Security bearerAuth
func (*ShortlinkController) HandleShortLink ¶
func (s *ShortlinkController) HandleShortLink(ct *gin.Context)
HandleShortlink handles the shortlink and redirects according to the configuration @BasePath / @Summary redirect to target @Schemes http https @Description redirect to target as per configuration of the shortlink @Produce text/html @Param shortlink path string true "shortlink id" @Success 200 {object} int "Success" @Success 300 {object} int "MultipleChoices" @Success 301 {object} int "MovedPermanently" @Success 302 {object} int "Found" @Success 303 {object} int "SeeOther" @Success 304 {object} int "NotModified" @Success 305 {object} int "UseProxy" @Success 307 {object} int "TemporaryRedirect" @Success 308 {object} int "PermanentRedirect" @Failure 404 {object} int "NotFound" @Failure 500 {object} int "InternalServerError" @Tags default @Router /{shortlink} [get]
func (*ShortlinkController) HandleUpdateShortLink ¶
func (s *ShortlinkController) HandleUpdateShortLink(ct *gin.Context)
HandleDeleteShortLink handles the update of a shortlink @BasePath /api/v1/ @Summary update existing shortlink @Schemes http https @Description update a new shortlink @Accept application/json @Produce text/plain @Produce application/json @Param shortlink path string true "the shortlink URL part (shortlink id)" example(home) @Param spec body v1alpha1.ShortLinkSpec true "shortlink spec" @Success 200 {object} int "Success" @Failure 401 {object} int "Unauthorized" @Failure 404 {object} int "NotFound" @Failure 500 {object} int "InternalServerError" @Tags api/v1/ @Router /api/v1/shortlink/{shortlink} [put] @Security bearerAuth