v0.1 (#8)
Co-authored-by: kjuulh <contact@kjuulh.io> Reviewed-on: kjuulh/kraken#8
This commit is contained in:
32
internal/schema/kraken.go
Normal file
32
internal/schema/kraken.go
Normal file
@@ -0,0 +1,32 @@
|
||||
package schema
|
||||
|
||||
import "gopkg.in/yaml.v3"
|
||||
|
||||
type KrakenSchema struct {
|
||||
ApiVersion string `yaml:"apiVersion"`
|
||||
Name string `yaml:"name"`
|
||||
Select struct {
|
||||
Repositories []string `yaml:"repositories"`
|
||||
Providers []struct {
|
||||
Gitea string `yaml:"gitea"`
|
||||
Organisation string `yaml:"organisation"`
|
||||
} `yaml:"providers"`
|
||||
} `yaml:"select"`
|
||||
Actions []struct {
|
||||
Type string `yaml:"type"`
|
||||
Entry string `yaml:"entry"`
|
||||
} `yaml:"actions"`
|
||||
Queries []struct {
|
||||
Type string `yaml:"type"`
|
||||
Query string `yaml:"query"`
|
||||
} `yaml:"queries"`
|
||||
}
|
||||
|
||||
func Unmarshal(raw string) (*KrakenSchema, error) {
|
||||
k := &KrakenSchema{}
|
||||
err := yaml.Unmarshal([]byte(raw), k)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return k, nil
|
||||
}
|
Reference in New Issue
Block a user