api

package
v0.28.1 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2026 License: MIT Imports: 36 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

View Source
const (
	ErrCodeInvalid          = 40001
	ErrCodeDup              = 40002
	ErrCodeFailed           = 40003
	ErrCodeNotFound         = 40004
	ErrCodeSaveConfigFailed = 40005
)

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 NewError added in v0.0.3

func NewError(status, code int, msg string) error

func Register added in v0.0.3

func Register(r *gin.Engine, opts *Options)

Types

type ErrCode added in v0.0.3

type ErrCode int

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 Options added in v0.0.3

type Options struct {
	AccessLog  bool
	PathPrefix string
	Auther     auth.Authenticator
}

type Response

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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