short/internal/oas/oas_server_gen.go

43 lines
983 B
Go
Raw Permalink Normal View History

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 {
// CreateShortURL implements createShortURL operation.
//
// Create a shorten URL.
2024-01-29 18:32:16 +00:00
//
// POST /create
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}
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
}