answer/internal/schema/plugin_admin_schema.go

47 lines
1.3 KiB
Go
Raw Normal View History

2023-01-10 16:43:42 +08:00
package schema
2023-01-29 16:06:17 +08:00
import "github.com/answerdev/answer/plugin"
const (
PluginStatusActive PluginStatus = "active"
PluginStatusInactive PluginStatus = "inactive"
)
type PluginStatus string
2023-01-13 12:50:20 +08:00
type GetPluginListReq struct {
Status PluginStatus `form:"status"`
HaveConfig bool `form:"have_config"`
}
type GetPluginListResp struct {
Name string `json:"name"`
2023-01-13 12:50:20 +08:00
SlugName string `json:"slug_name"`
Description string `json:"description"`
Version string `json:"version"`
Enabled bool `json:"enabled"`
2023-01-13 12:50:20 +08:00
HaveConfig bool `json:"have_config"`
}
2023-01-10 16:43:42 +08:00
type UpdatePluginStatusReq struct {
PluginSlugName string `validate:"required,gt=1,lte=100" json:"plugin_slug_name"`
Enabled bool `json:"enabled"`
}
type GetPluginConfigReq struct {
2023-01-13 12:50:20 +08:00
PluginSlugName string `validate:"required,gt=1,lte=100" form:"plugin_slug_name"`
}
type GetPluginConfigResp struct {
2023-01-29 16:06:17 +08:00
Name string `json:"name"`
SlugName string `json:"slug_name"`
Description string `json:"description"`
Version string `json:"version"`
ConfigFields []plugin.ConfigField `json:"config_fields"`
}
type UpdatePluginConfigReq struct {
2023-01-13 12:50:20 +08:00
PluginSlugName string `validate:"required,gt=1,lte=100" json:"plugin_slug_name"`
ConfigFields map[string]any `json:"config_fields"`
}