Documentation ¶
Overview ¶
Package app_openapi provides primitives to interact with the openapi HTTP API.
Code generated by github.com/deepmap/oapi-codegen version v1.8.2 DO NOT EDIT.
Package app_openapi provides primitives to interact with the openapi HTTP API.
Code generated by github.com/deepmap/oapi-codegen version v1.8.2 DO NOT EDIT.
Package app_openapi provides primitives to interact with the openapi HTTP API.
Code generated by github.com/deepmap/oapi-codegen version v1.8.2 DO NOT EDIT.
Index ¶
- func GetSwagger() (swagger *openapi3.T, err error)
- func Handler(si ServerInterface) http.Handler
- func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler
- func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler
- func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler
- func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error)
- type ChiServerOptions
- type CreateShortUrlJSONBody
- type CreateShortUrlJSONRequestBody
- type Link
- type MiddlewareFunc
- type RequestShortUrl
- type ResponseShortUrl
- type ServerInterface
- type ServerInterfaceWrapper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetSwagger ¶
GetSwagger returns the Swagger specification corresponding to the generated code in this file. The external references of Swagger specification are resolved. The logic of resolving external references is tightly connected to "import-mapping" feature. Externally referenced files must be embedded in the corresponding golang packages. Urls can be supported but this task was out of the scope.
func Handler ¶
func Handler(si ServerInterface) http.Handler
Handler creates http.Handler with routing matching OpenAPI spec.
func HandlerFromMux ¶
func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler
HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux.
func HandlerFromMuxWithBaseURL ¶
func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler
func HandlerWithOptions ¶
func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler
HandlerWithOptions creates http.Handler with additional options
Types ¶
type ChiServerOptions ¶
type ChiServerOptions struct { BaseURL string BaseRouter chi.Router Middlewares []MiddlewareFunc }
type CreateShortUrlJSONBody ¶
type CreateShortUrlJSONBody RequestShortUrl
CreateShortUrlJSONBody defines parameters for CreateShortUrl.
type CreateShortUrlJSONRequestBody ¶
type CreateShortUrlJSONRequestBody CreateShortUrlJSONBody
CreateShortUrlJSONRequestBody defines body for CreateShortUrl for application/json ContentType.
type Link ¶
type Link struct { CreatedAt time.Time `json:"createdAt"` DeletedAt *time.Time `json:"deletedAt,omitempty"` ExpiredAt *time.Time `json:"expiredAt,omitempty"` Hits int32 `json:"hits"` TargetUrl string `json:"targetUrl"` Token string `json:"token"` }
Link defines model for Link.
type MiddlewareFunc ¶
type MiddlewareFunc func(http.HandlerFunc) http.HandlerFunc
type RequestShortUrl ¶
type RequestShortUrl struct { ExpiredInDays *int32 `json:"expiredInDays,omitempty"` TargetUrl string `json:"targetUrl"` }
RequestShortUrl defines model for RequestShortUrl.
type ResponseShortUrl ¶
type ResponseShortUrl struct { ShortUrl string `json:"shortUrl"` ShortUrlInfo *string `json:"shortUrlInfo,omitempty"` }
ResponseShortUrl defines model for ResponseShortUrl.
type ServerInterface ¶
type ServerInterface interface { // Request short url (token) for target url with expiration interval (in days) setting // (POST /) CreateShortUrl(w http.ResponseWriter, r *http.Request) // Redirect to target url by token // (GET /{token}) HitShortUrl(w http.ResponseWriter, r *http.Request, token string) // Get short url info // (GET /{token}/info) GetShortUrlInfo(w http.ResponseWriter, r *http.Request, token string) }
ServerInterface represents all server handlers.
type ServerInterfaceWrapper ¶
type ServerInterfaceWrapper struct { Handler ServerInterface HandlerMiddlewares []MiddlewareFunc }
ServerInterfaceWrapper converts contexts to parameters.
func (*ServerInterfaceWrapper) CreateShortUrl ¶
func (siw *ServerInterfaceWrapper) CreateShortUrl(w http.ResponseWriter, r *http.Request)
CreateShortUrl operation middleware
func (*ServerInterfaceWrapper) GetShortUrlInfo ¶
func (siw *ServerInterfaceWrapper) GetShortUrlInfo(w http.ResponseWriter, r *http.Request)
GetShortUrlInfo operation middleware
func (*ServerInterfaceWrapper) HitShortUrl ¶
func (siw *ServerInterfaceWrapper) HitShortUrl(w http.ResponseWriter, r *http.Request)
HitShortUrl operation middleware