2023-01-10 16:43:42 +08:00
|
|
|
package schema
|
|
|
|
|
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-13 12:50:20 +08:00
|
|
|
//ConfigFields []plugin.ConfigField `json:"config_fields"`
|
|
|
|
Name string `json:"name"`
|
|
|
|
SlugName string `json:"slug_name"`
|
|
|
|
Description string `json:"description"`
|
|
|
|
Version string `json:"version"`
|
|
|
|
ConfigFields []*ConfigField `json:"config_fields"`
|
|
|
|
}
|
|
|
|
|
|
|
|
const (
|
|
|
|
TEXT ConfigFieldType = "text"
|
|
|
|
Select ConfigFieldType = "select"
|
|
|
|
Checkbox ConfigFieldType = "checkbox"
|
|
|
|
)
|
|
|
|
|
|
|
|
type ConfigFieldType string
|
|
|
|
|
|
|
|
type ConfigField struct {
|
|
|
|
Name string `json:"name"`
|
|
|
|
Type ConfigFieldType `json:"type"`
|
|
|
|
Title string `json:"title"`
|
|
|
|
Description string `json:"description"`
|
|
|
|
Required bool `json:"required"`
|
|
|
|
Value string `json:"value"`
|
|
|
|
UIOptions UIOptions `json:"ui_options"`
|
|
|
|
Options []Option `json:"options"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type UIOptions struct {
|
|
|
|
Placeholder string `json:"placeholder"`
|
|
|
|
Type string `json:"type"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type Option struct {
|
|
|
|
Label string `json:"label"`
|
|
|
|
Value string `json:"value"`
|
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
|
|
|
}
|