ports

package
v0.0.0-...-a2f079e Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 9, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package ports provides primitives to interact with the openapi HTTP API.

Code generated by github.com/deepmap/oapi-codegen version v1.9.1 DO NOT EDIT.

Package ports provides primitives to interact with the openapi HTTP API.

Code generated by github.com/deepmap/oapi-codegen version v1.9.1 DO NOT EDIT.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterHandlers

func RegisterHandlers(router *gin.Engine, si ServerInterface) *gin.Engine

RegisterHandlers creates http.Handler with routing matching OpenAPI spec.

func RegisterHandlersWithOptions

func RegisterHandlersWithOptions(router *gin.Engine, si ServerInterface, options GinServerOptions) *gin.Engine

RegisterHandlersWithOptions creates http.Handler with additional options

Types

type CreateShortUrlJSONBody

type CreateShortUrlJSONBody PostShortUrl

CreateShortUrlJSONBody defines parameters for CreateShortUrl.

type CreateShortUrlJSONRequestBody

type CreateShortUrlJSONRequestBody CreateShortUrlJSONBody

CreateShortUrlJSONRequestBody defines body for CreateShortUrl for application/json ContentType.

type Error

type Error struct {
	Slug string `json:"slug"`
}

Error defines model for Error.

type GinServerOptions

type GinServerOptions struct {
	BaseURL     string
	Middlewares []MiddlewareFunc
}

GinServerOptions provides options for the Gin server.

type HttpServer

type HttpServer struct {
	// contains filtered or unexported fields
}

func NewHttpServer

func NewHttpServer(service app.ShortUrlService) *HttpServer

func (HttpServer) CreateShortUrl

func (h HttpServer) CreateShortUrl(c *gin.Context)

func (HttpServer) RedirectToOriginUrl

func (h HttpServer) RedirectToOriginUrl(c *gin.Context, urlId string)

type MiddlewareFunc

type MiddlewareFunc func(c *gin.Context)

type PostShortUrl

type PostShortUrl struct {
	ExpireAt time.Time `json:"expireAt"`
	Url      string    `json:"url"`
}

PostShortUrl defines model for PostShortUrl.

type ServerInterface

type ServerInterface interface {

	// (POST /api/v1/urls)
	CreateShortUrl(c *gin.Context)

	// (GET /{urlId})
	RedirectToOriginUrl(c *gin.Context, urlId 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(c *gin.Context)

CreateShortUrl operation middleware

func (*ServerInterfaceWrapper) RedirectToOriginUrl

func (siw *ServerInterfaceWrapper) RedirectToOriginUrl(c *gin.Context)

RedirectToOriginUrl operation middleware

type ShortUrl

type ShortUrl struct {
	Id       string `json:"id"`
	ShortUrl string `json:"shortUrl"`
}

ShortUrl defines model for ShortUrl.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL