2023-01-10 16:43:42 +08:00
|
|
|
package schema
|
|
|
|
|
2023-01-29 16:06:17 +08:00
|
|
|
import "github.com/answerdev/answer/plugin"
|
|
|
|
|
2023-01-11 10:02:45 +08:00
|
|
|
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"`
|
|
|
|
}
|
|
|
|
|
2023-01-11 10:02:45 +08:00
|
|
|
type GetPluginListResp struct {
|
|
|
|
Name string `json:"name"`
|
2023-01-13 12:50:20 +08:00
|
|
|
SlugName string `json:"slug_name"`
|
2023-01-11 10:02:45 +08:00
|
|
|
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-11 10:02:45 +08:00
|
|
|
}
|
|
|
|
|
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"`
|
|
|
|
}
|
2023-01-11 10:02:45 +08:00
|
|
|
|
|
|
|
type GetPluginConfigReq struct {
|
2023-01-13 12:50:20 +08:00
|
|
|
PluginSlugName string `validate:"required,gt=1,lte=100" form:"plugin_slug_name"`
|
2023-01-11 10:02:45 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
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"`
|
2023-01-11 10:02:45 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
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"`
|
2023-01-11 10:02:45 +08:00
|
|
|
}
|