mirror of
https://github.com/teamhanko/hanko.git
synced 2025-10-29 15:49:41 +08:00
30 lines
773 B
Go
30 lines
773 B
Go
package flowpilot
|
|
|
|
import (
|
|
"encoding/json"
|
|
"github.com/teamhanko/hanko/backend/v2/flowpilot/jsonmanager"
|
|
)
|
|
|
|
type actionInput interface {
|
|
jsonmanager.JSONManager
|
|
}
|
|
|
|
type readOnlyActionInput interface {
|
|
jsonmanager.ReadOnlyJSONManager
|
|
}
|
|
|
|
// newActionInput creates a new instance of actionInput with empty JSON data.
|
|
func newActionInput() actionInput {
|
|
return jsonmanager.NewJSONManager()
|
|
}
|
|
|
|
// newActionInputFromInputData creates a new instance of actionInput with the given JSON data
|
|
// which was previously unmarshalled into a generic map.
|
|
func newActionInputFromInputData(data InputData) (actionInput, error) {
|
|
dataBytes, err := json.Marshal(data.InputDataMap)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return jsonmanager.NewJSONManagerFromString(string(dataBytes))
|
|
}
|