httpapi

package
v1.7.2 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2024 License: MIT Imports: 5 Imported by: 2

Documentation

Overview

This file is autogenerated. Do not modify

This file is autogenerated. Do not modify

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendRoutes

func AppendRoutes(router *mux.Router, controllers ...HttpController) *mux.Router

AppendRoutes appends the routes of one or more Controllers to a mux.Router. If a nil router is passed, a new router will be created here.

func WriteAnyResponse

func WriteAnyResponse(w http.ResponseWriter, statuscode int, data interface{}) (int, error)

WriteTextResponse sets an HTTP response with the provided status-code and string.

func WriteByteResponse

func WriteByteResponse(w http.ResponseWriter, statuscode int, data []byte) (int, error)

func WriteCustomJSONResponse

func WriteCustomJSONResponse(w http.ResponseWriter, statuscode int, data []byte) (int, error)

WriteJSONResponse sets an HTTP response with the provided status-code and JSON data.

func WriteDefaultResponse

func WriteDefaultResponse(w http.ResponseWriter, status int) (int, error)

WriteDefaultResponse sets the body of a response with the text associated with the HTTP status.

func WriteJSONResponse

func WriteJSONResponse(w http.ResponseWriter, statuscode int, data JSONWriter) (int, error)

WriteJSONResponse sets an HTTP response with the provided status-code and JSON body.

func WriteYAMLResponse

func WriteYAMLResponse(w http.ResponseWriter, statuscode int, data YAMLWriter) (int, error)

WriteYAMLResponse sets an HTTP response with the provided status-code and JSON body.

Types

type HttpController

type HttpController interface {
	Routes() []Route
}

Controller creates a set of HTTP routes.

type JSONWriter

type JSONWriter interface {
	ToJson() (string, error)
}

JSONWriter offers conversion to JSON.

type Route

type Route struct {
	Name    string
	Method  string
	Path    string
	Handler http.HandlerFunc
}

Route defines the parameters for an api endpoint.

type YAMLWriter

type YAMLWriter interface {
	ToYaml() string
}

YAMLWriter offers conversion to YAML.

Directories

Path Synopsis
This file is autogenerated.
This file is autogenerated.
This file is autogenerated.
This file is autogenerated.

Jump to

Keyboard shortcuts

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