41 lines
899 B
Go
41 lines
899 B
Go
|
// Code generated by ogen, DO NOT EDIT.
|
||
|
|
||
|
package oas
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
)
|
||
|
|
||
|
// Handler handles operations described by OpenAPI v3 specification.
|
||
|
type Handler interface {
|
||
|
// CreatePost implements POST /create operation.
|
||
|
//
|
||
|
// POST /create
|
||
|
CreatePost(ctx context.Context, req *CreatePostReq) (CreatePostRes, error)
|
||
|
// HashGet implements GET /{hash} operation.
|
||
|
//
|
||
|
// Redirect client to long URL.
|
||
|
//
|
||
|
// GET /{hash}
|
||
|
HashGet(ctx context.Context, params HashGetParams) (HashGetRes, error)
|
||
|
}
|
||
|
|
||
|
// 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
|
||
|
}
|