routes

package
v0.0.0-...-0637108 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

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

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterHandlers

func RegisterHandlers(router EchoRouter, si ServerInterface)

RegisterHandlers adds each server route to the EchoRouter.

func RegisterHandlersWithBaseURL

func RegisterHandlersWithBaseURL(router EchoRouter, si ServerInterface, baseURL string)

Registers handlers, and prepends BaseURL to the paths, so that the paths can be served under a prefix.

Types

type EchoRouter

type EchoRouter interface {
	CONNECT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	DELETE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	GET(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	HEAD(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	OPTIONS(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	PATCH(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	POST(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	PUT(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
	TRACE(path string, h echo.HandlerFunc, m ...echo.MiddlewareFunc) *echo.Route
}

This is a simple interface which specifies echo.Route addition functions which are present on both echo.Echo and echo.Group, since we want to allow using either of them for path registration

type GetMetadataParams

type GetMetadataParams struct {
	// Url The URL for which you want to retrieve OpenGraph data.
	Url string `form:"url" json:"url"`
}

GetMetadataParams defines parameters for GetMetadata.

type Metadata

type Metadata struct {
	Description string `json:"description"`
	Image       string `json:"image"`
	Title       string `json:"title"`
	Url         string `json:"url"`
}

Metadata defines model for Metadata.

type OpenGraphParams

type OpenGraphParams struct {
	// Url The URL for which you want to retrieve OpenGraph data.
	Url string `form:"url" json:"url"`

	// Title Optional custom title to use for OpenGraph data.
	Title *string `form:"title,omitempty" json:"title,omitempty"`

	// Description Optional custom description to use for OpenGraph data.
	Description *string `form:"description,omitempty" json:"description,omitempty"`

	// Image Optional custom image to use for OpenGraph data.
	Image *string `form:"image,omitempty" json:"image,omitempty"`
}

OpenGraphParams defines parameters for OpenGraph.

type ServerInterface

type ServerInterface interface {
	// Get metadata of a URL
	// (GET /metadata)
	GetMetadata(ctx echo.Context, params GetMetadataParams) error
	// OpenGraph Data
	// (GET /opengraph)
	OpenGraph(ctx echo.Context, params OpenGraphParams) error
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler ServerInterface
}

ServerInterfaceWrapper converts echo contexts to parameters.

func (*ServerInterfaceWrapper) GetMetadata

func (w *ServerInterfaceWrapper) GetMetadata(ctx echo.Context) error

GetMetadata converts echo context to params.

func (*ServerInterfaceWrapper) OpenGraph

func (w *ServerInterfaceWrapper) OpenGraph(ctx echo.Context) error

OpenGraph converts echo context to params.

Jump to

Keyboard shortcuts

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