50 lines
1.2 KiB
Cheetah
50 lines
1.2 KiB
Cheetah
|
|
// Code generated by ndpgen. DO NOT EDIT.
|
||
|
|
|
||
|
|
/*
|
||
|
|
Package {{.Package}} provides Navidrome Plugin Development Kit wrappers for Go/TinyGo plugins.
|
||
|
|
|
||
|
|
This package is auto-generated by the ndpgen tool and should not be edited manually.
|
||
|
|
|
||
|
|
# Usage
|
||
|
|
|
||
|
|
Add this module as a dependency in your plugin's go.mod:
|
||
|
|
|
||
|
|
require github.com/navidrome/navidrome/plugins/pdk/go/host v0.0.0
|
||
|
|
|
||
|
|
Then import the package in your plugin code:
|
||
|
|
|
||
|
|
import {{.Package}} "github.com/navidrome/navidrome/plugins/pdk/go/host"
|
||
|
|
|
||
|
|
func myPluginFunction() error {
|
||
|
|
// Use the cache service
|
||
|
|
_, err := {{.Package}}.CacheSetString("my_key", "my_value", 3600)
|
||
|
|
if err != nil {
|
||
|
|
return err
|
||
|
|
}
|
||
|
|
|
||
|
|
// Schedule a recurring task
|
||
|
|
_, err = {{.Package}}.SchedulerScheduleRecurring("@every 5m", "payload", "task_id")
|
||
|
|
if err != nil {
|
||
|
|
return err
|
||
|
|
}
|
||
|
|
|
||
|
|
return nil
|
||
|
|
}
|
||
|
|
|
||
|
|
# Available Services
|
||
|
|
|
||
|
|
The following host services are available:
|
||
|
|
{{range .Services}}
|
||
|
|
- {{.Name}}: {{if .Doc}}{{.Doc | firstLine}}{{else}}{{.Name}} service{{end}}
|
||
|
|
{{- end}}
|
||
|
|
|
||
|
|
# Building Plugins
|
||
|
|
|
||
|
|
Go plugins must be compiled to WebAssembly using TinyGo:
|
||
|
|
|
||
|
|
tinygo build -o plugin.wasm -target=wasip1 -buildmode=c-shared .
|
||
|
|
|
||
|
|
See the examples directory for complete plugin implementations.
|
||
|
|
*/
|
||
|
|
package {{.Package}}
|