Documentation ¶
Index ¶
- type Handler
- func (h *Handler) BuiltInfoEndpoint(res http.ResponseWriter, req *http.Request)
- func (h *Handler) RedirectFullURL(res http.ResponseWriter, req *http.Request)
- func (h *Handler) ReportEndpoint(res http.ResponseWriter, req *http.Request)
- func (h *Handler) ShortenEndpoint(res http.ResponseWriter, req *http.Request)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
func NewHandler ¶
func NewHandler(logger *zap.SugaredLogger, container *ioc.Container) *Handler
func (*Handler) BuiltInfoEndpoint ¶
func (h *Handler) BuiltInfoEndpoint(res http.ResponseWriter, req *http.Request)
swagger:route GET /service-info service BuildInfo
Returns build information ¶
Produces: - application/json
Responses:
200: BuiltInfo
func (*Handler) RedirectFullURL ¶
func (h *Handler) RedirectFullURL(res http.ResponseWriter, req *http.Request)
func (*Handler) ReportEndpoint ¶
func (h *Handler) ReportEndpoint(res http.ResponseWriter, req *http.Request)
swagger:operation GET /report shortener URLReport
Returns report information ¶
--- produces: - application/json
parameters:
- name: limit in: query description: Max number of records to return required: false type: integer format: int64 default: 100
- name: offset in: query description: Offset needed to return a specific subset of records required: false type: integer format: int64 default: 0
responses:
200: description: returns report information schema: type: array items: "$ref": "#/definitions/ShortURLReportDto" 400: description: Invalid input 500: description: Internal error
func (*Handler) ShortenEndpoint ¶
func (h *Handler) ShortenEndpoint(res http.ResponseWriter, req *http.Request)
swagger:operation POST /shorten shortener shortenURL
Creates a new short URL for given URL ¶
--- Consumes: - application/json
Produces: - application/json
parameters:
- in: body name: url description: URL to shorten schema: type: object required:
- fullURL properties: fullURL: type: string
Responses:
200: description: Short URL already exists schema: type: object properties: shortURL: type: string description: Short URL 201: description: Created short URL schema: type: object properties: shortURL: type: string description: Short URL 400: description: Invalid input 500: description: Internal error
Click to show internal directories.
Click to hide internal directories.