api

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 11, 2024 License: MIT Imports: 28 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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