api

package
v1.3.4-beta Latest Latest
Warning

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

Go to latest
Published: Dec 18, 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
	Protocols []string
	Upstream  string
	CreateAt  time.Time
	IsDelete  bool
}

func FromEntity

func FromEntity(e *api.API) *API

type Create

type Create struct {
	UUID        string
	Name        string
	Description string
	Service     string
	Team        string
	Methods     []string
	Protocols   []string
	Upstream    string
	Disable     bool
	Path        string
	Match       string
}

type Document

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

type Edit

type Edit struct {
	Name        *string
	Description *string
	Methods     *[]string
	Protocols   *[]string
	Disable     *bool
	Path        *string
	Upstream    *string
	Match       *string
}

type Exist

type Exist struct {
	Path    string
	Methods []string
}
type Header struct {
	Key   string `json:"key"`
	Value string `json:"value"`
	Opt   string `json:"opt"`
}

type HistoryType

type HistoryType string
const (
	HistoryRequest HistoryType = "request"
	HistoryProxy   HistoryType = "proxy"
	HistoryPlugin  HistoryType = "plugin"
)

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 *Exist) error
	ListForService(ctx context.Context, serviceId string) ([]*API, error)
	ListForServices(ctx context.Context, serviceIds ...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)
	ListInfoForServices(ctx context.Context, serviceIds ...string) ([]*Info, error)

	ListLatestCommitProxy(ctx context.Context, aid ...string) ([]*commit.Commit[Proxy], error)
	LatestProxy(ctx context.Context, aid string) (*commit.Commit[Proxy], error)
	GetProxyCommit(ctx context.Context, commitId string) (*commit.Commit[Proxy], error)
	ListProxyCommit(ctx context.Context, commitId ...string) ([]*commit.Commit[Proxy], error)
	SaveProxy(ctx context.Context, aid string, data *Proxy) error

	ListLatestCommitRequest(ctx context.Context, aid ...string) ([]*commit.Commit[Request], error)
	GetRequestCommit(ctx context.Context, commitId string) (*commit.Commit[Request], error)
	ListRequestCommit(ctx context.Context, commitId ...string) ([]*commit.Commit[Request], error)
	SaveRequest(ctx context.Context, aid string, data *Request) error
	LatestRequest(ctx context.Context, aid string) (*commit.Commit[Request], error)

	Save(ctx context.Context, id string, model *Edit) error
	Create(ctx context.Context, input *Create) (err error)
}

type Info

type Info struct {
	UUID        string
	Name        string
	Description string
	CreateAt    time.Time
	UpdateAt    time.Time
	Service     string
	Team        string
	Upstream    string
	Creator     string
	Updater     string
	Methods     []string
	Protocols   []string
	Path        string
	Match       string
	Disable     bool
}

func FromEntityInfo

func FromEntityInfo(e *api.Info) *Info

type Kind

type Kind string

type Match

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

type Plugin

type Plugin map[string]interface{}

type PluginSetting

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

type Proxy

type Proxy struct {
	Path     string                   `json:"path"`
	Upstream string                   `json:"upstream"`
	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 Request

type Request struct {
	Name      string   `json:"name"`
	Path      string   `json:"path"`
	Methods   []string `json:"methods"`
	Protocols []string `json:"protocols"`
	Match     string   `json:"match"`
	Disable   bool     `json:"disable"`
	Upstream  string   `json:"upstream"`
}

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