api

package
v1.0.0-beta Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	UUID     string
	Service  string
	Team     string
	Creator  string
	Method   string
	Path     string
	CreateAt time.Time
	IsDelete bool
}

func FromEntity

func FromEntity(e *api.Api) *API

type CreateAPI

type CreateAPI struct {
	UUID        string
	Name        string
	Description string
	Service     string
	Team        string
	Method      string
	Path        string
	Match       string
}

type Document

type Document struct {
	Content string `json:"content"`
}

type EditAPI

type EditAPI struct {
	Name        *string
	Upstream    *string
	Description *string
}

type ExistAPI

type ExistAPI struct {
	Path   string
	Method string
}
type Header struct {
	Key   string `json:"key"`
	Value string `json:"value"`
	Opt   string `json:"opt"`
}

type HistoryType

type HistoryType string
const (
	HistoryDocument HistoryType = "doc"
	HistoryProxy    HistoryType = "proxy"
)

type IAPIService

type IAPIService interface {
	universally.IServiceGet[API]
	universally.IServiceDelete
	CountByService(ctx context.Context, service string) (int64, error)
	CountMapByService(ctx context.Context, service ...string) (map[string]int64, error)
	Exist(ctx context.Context, aid string, api *ExistAPI) error
	ListForService(ctx context.Context, serviceId string) ([]*API, error)
	GetInfo(ctx context.Context, aid string) (*Info, error)
	ListInfo(ctx context.Context, aids ...string) ([]*Info, error)
	ListInfoForService(ctx context.Context, serviceId string) ([]*Info, error)
	ListLatestCommitProxy(ctx context.Context, aid ...string) ([]*commit.Commit[Proxy], error)
	ListLatestCommitDocument(ctx context.Context, aid ...string) ([]*commit.Commit[Document], error)
	LatestProxy(ctx context.Context, aid string) (*commit.Commit[Proxy], error)
	LatestDocument(ctx context.Context, aid string) (*commit.Commit[Document], error)
	GetProxyCommit(ctx context.Context, commitId string) (*commit.Commit[Proxy], error)
	ListProxyCommit(ctx context.Context, commitId ...string) ([]*commit.Commit[Proxy], error)
	GetDocumentCommit(ctx context.Context, commitId string) (*commit.Commit[Document], error)
	ListDocumentCommit(ctx context.Context, commitId ...string) ([]*commit.Commit[Document], error)
	SaveProxy(ctx context.Context, aid string, data *Proxy) error
	SaveDocument(ctx context.Context, aid string, data *Document) error
	Save(ctx context.Context, id string, model *EditAPI) error
	Create(ctx context.Context, input *CreateAPI) (err error)
}

type Info

type Info struct {
	UUID        string
	Name        string
	Description string
	CreateAt    time.Time
	UpdateAt    time.Time
	Service     string
	Team        string
	Creator     string
	Updater     string
	Upstream    string
	Method      string
	Path        string
	Match       string
}

type Match

type Match struct {
	Position  string `json:"position"`
	MatchType string `json:"match_type"`
	Key       string `json:"key"`
	Pattern   string `json:"pattern"`
}

type PluginSetting

type PluginSetting struct {
	Disable bool                    `json:"disable"`
	Config  plugin_model.ConfigType `json:"config"`
}

type Proxy

type Proxy struct {
	Path    string                   `json:"path"`
	Timeout int                      `json:"timeout"`
	Retry   int                      `json:"retry"`
	Plugins map[string]PluginSetting `json:"plugins"`
	Extends map[string]any           `json:"extends"`
	Headers []*Header                `json:"headers"`
}

type Router

type Router struct {
	Method     string   `json:"method"`
	Path       string   `json:"path"`
	MatchRules []*Match `json:"match"`
}

Jump to

Keyboard shortcuts

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