controller

package
v0.0.0-...-18fdf9b Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2024 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContentTypeApplicationJSON = "application/json"
	ContentTypeTextPlain       = "text/plain"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type GithubUser

type GithubUser struct {
	Id         int    `json:"id,omitempty"`
	Login      string `json:"login,omitempty"`
	Avatar_url string `json:"avatar_url,omitempty"`
	Type       string `json:"type,omitempty"`
	Name       string `json:"name,omitempty"`
	Email      string `json:"email,omitempty"`
}

type JsonReturnError

type JsonReturnError struct {
	Code  int    `json:"code"`
	Error string `json:"error"`
}
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 (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 (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 (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 (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 (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 (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

Jump to

Keyboard shortcuts

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