2024-01-29 18:32:16 +00:00
|
|
|
// Code generated by ogen, DO NOT EDIT.
|
|
|
|
|
|
|
|
package oas
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
)
|
|
|
|
|
|
|
|
// Handler handles operations described by OpenAPI v3 specification.
|
|
|
|
type Handler interface {
|
2024-01-29 18:51:23 +00:00
|
|
|
// CreateShortURL implements createShortURL operation.
|
|
|
|
//
|
|
|
|
// Create a shorten URL.
|
2024-01-29 18:32:16 +00:00
|
|
|
//
|
|
|
|
// POST /create
|
2024-01-29 18:51:23 +00:00
|
|
|
CreateShortURL(ctx context.Context, req *CreateShortURLReq) (CreateShortURLRes, error)
|
|
|
|
// RedirectLongURL implements redirectLongURL operation.
|
2024-01-29 18:32:16 +00:00
|
|
|
//
|
|
|
|
// Redirect client to long URL.
|
|
|
|
//
|
|
|
|
// GET /{hash}
|
2024-01-29 18:51:23 +00:00
|
|
|
RedirectLongURL(ctx context.Context, params RedirectLongURLParams) (RedirectLongURLRes, error)
|
2024-01-29 18:32:16 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Server implements http server based on OpenAPI v3 specification and
|
|
|
|
// calls Handler to handle requests.
|
|
|
|
type Server struct {
|
|
|
|
h Handler
|
|
|
|
baseServer
|
|
|
|
}
|
|
|
|
|
|
|
|
// NewServer creates new Server.
|
|
|
|
func NewServer(h Handler, opts ...ServerOption) (*Server, error) {
|
|
|
|
s, err := newServerConfig(opts...).baseServer()
|
|
|
|
if err != nil {
|
|
|
|
return nil, err
|
|
|
|
}
|
|
|
|
return &Server{
|
|
|
|
h: h,
|
|
|
|
baseServer: s,
|
|
|
|
}, nil
|
|
|
|
}
|