mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 20:34:37 +03:00
Separate graphql API from rest of the system (#2503)
* Move graphql generated files to api * Refactor identify options * Remove models.StashBoxes * Move ScraperSource to scraper package * Rename field strategy enums * Rename identify.TaskOptions to Options
This commit is contained in:
@@ -1,10 +1,20 @@
|
||||
package plugin
|
||||
|
||||
import (
|
||||
"github.com/stashapp/stash/pkg/models"
|
||||
)
|
||||
type PluginArgInput struct {
|
||||
Key string `json:"key"`
|
||||
Value *PluginValueInput `json:"value"`
|
||||
}
|
||||
|
||||
func findArg(args []*models.PluginArgInput, name string) *models.PluginArgInput {
|
||||
type PluginValueInput struct {
|
||||
Str *string `json:"str"`
|
||||
I *int `json:"i"`
|
||||
B *bool `json:"b"`
|
||||
F *float64 `json:"f"`
|
||||
O []*PluginArgInput `json:"o"`
|
||||
A []*PluginValueInput `json:"a"`
|
||||
}
|
||||
|
||||
func findArg(args []*PluginArgInput, name string) *PluginArgInput {
|
||||
for _, v := range args {
|
||||
if v.Key == name {
|
||||
return v
|
||||
@@ -14,13 +24,13 @@ func findArg(args []*models.PluginArgInput, name string) *models.PluginArgInput
|
||||
return nil
|
||||
}
|
||||
|
||||
func applyDefaultArgs(args []*models.PluginArgInput, defaultArgs map[string]string) []*models.PluginArgInput {
|
||||
func applyDefaultArgs(args []*PluginArgInput, defaultArgs map[string]string) []*PluginArgInput {
|
||||
for k, v := range defaultArgs {
|
||||
if arg := findArg(args, k); arg == nil {
|
||||
v := v // Copy v, because it's being exported out of the loop
|
||||
args = append(args, &models.PluginArgInput{
|
||||
args = append(args, &PluginArgInput{
|
||||
Key: k,
|
||||
Value: &models.PluginValueInput{
|
||||
Value: &PluginValueInput{
|
||||
Str: &v,
|
||||
},
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user