api

package module
v0.0.0-...-966d66c Latest Latest
Warning

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

Go to latest
Published: Mar 16, 2022 License: MIT Imports: 16 Imported by: 1

Documentation

Overview

Documentation of Web API.

Schemes: https, http
BasePath: /
Version: 1.0.0

Consumes:
- application/json

Produces:
- application/json

SecurityDefinitions:
basicAuth:
  type: basic

swagger:meta

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalid  = &Error{statusCode: http.StatusBadRequest, Code: 40001, Msg: "object invalid"}
	ErrDup      = &Error{statusCode: http.StatusBadRequest, Code: 40002, Msg: "object duplicated"}
	ErrCreate   = &Error{statusCode: http.StatusConflict, Code: 40003, Msg: "object creation failed"}
	ErrNotFound = &Error{statusCode: http.StatusBadRequest, Code: 40004, Msg: "object not found"}
	ErrSave     = &Error{statusCode: http.StatusInternalServerError, Code: 40005, Msg: "save config failed"}
)

Functions

func NewService

func NewService(addr string, opts ...Option) (service.Service, error)

Types

type Error

type Error struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`
	// contains filtered or unexported fields
}

Error is an api error.

func (*Error) Error

func (e *Error) Error() string

type Option

type Option func(*options)

func AccessLogOption

func AccessLogOption(enable bool) Option

func AutherOption

func AutherOption(auther auth.Authenticator) Option

func PathPrefixOption

func PathPrefixOption(pathPrefix string) Option

type Response

type Response struct {
	Code int    `json:"code,omitempty"`
	Msg  string `json:"msg,omitempty"`
}

Jump to

Keyboard shortcuts

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