mirror of
https://github.com/sonr-io/sonr.git
synced 2026-08-02 17:31:39 +00:00
feat: add Input and RegistrationForm models
This commit is contained in:
@@ -1,36 +0,0 @@
|
||||
// Code generated from Pkl module `format`. DO NOT EDIT.
|
||||
package format
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/apple/pkl-go/pkl"
|
||||
)
|
||||
|
||||
type Format struct {
|
||||
}
|
||||
|
||||
// LoadFromPath loads the pkl module at the given path and evaluates it into a Format
|
||||
func LoadFromPath(ctx context.Context, path string) (ret *Format, err error) {
|
||||
evaluator, err := pkl.NewEvaluator(ctx, pkl.PreconfiguredOptions)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
defer func() {
|
||||
cerr := evaluator.Close()
|
||||
if err == nil {
|
||||
err = cerr
|
||||
}
|
||||
}()
|
||||
ret, err = Load(ctx, evaluator, pkl.FileSource(path))
|
||||
return ret, err
|
||||
}
|
||||
|
||||
// Load loads the pkl module at the given source and evaluates it with the given evaluator into a Format
|
||||
func Load(ctx context.Context, evaluator pkl.Evaluator, source *pkl.ModuleSource) (*Format, error) {
|
||||
var ret Format
|
||||
if err := evaluator.EvaluateModule(ctx, source, &ret); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &ret, nil
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
// Code generated from Pkl module `format`. DO NOT EDIT.
|
||||
package format
|
||||
|
||||
type Macaroon struct {
|
||||
Location string `pkl:"location" json:"location,omitempty"`
|
||||
|
||||
Originator string `pkl:"originator" json:"originator,omitempty"`
|
||||
|
||||
Identifier string `pkl:"identifier" json:"identifier,omitempty"`
|
||||
|
||||
FirstParty []string `pkl:"first_party" json:"first_party,omitempty"`
|
||||
|
||||
ThirdParty []string `pkl:"third_party" json:"third_party,omitempty"`
|
||||
|
||||
Expiration int `pkl:"expiration" json:"expiration,omitempty"`
|
||||
}
|
||||
@@ -1,52 +0,0 @@
|
||||
// Code generated from Pkl module `format`. DO NOT EDIT.
|
||||
package didmethod
|
||||
|
||||
import (
|
||||
"encoding"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
type DIDMethod string
|
||||
|
||||
const (
|
||||
Ipfs DIDMethod = "ipfs"
|
||||
Sonr DIDMethod = "sonr"
|
||||
Bitcoin DIDMethod = "bitcoin"
|
||||
Ethereum DIDMethod = "ethereum"
|
||||
Ibc DIDMethod = "ibc"
|
||||
Webauthn DIDMethod = "webauthn"
|
||||
Dwn DIDMethod = "dwn"
|
||||
Service DIDMethod = "service"
|
||||
)
|
||||
|
||||
// String returns the string representation of DIDMethod
|
||||
func (rcv DIDMethod) String() string {
|
||||
return string(rcv)
|
||||
}
|
||||
|
||||
var _ encoding.BinaryUnmarshaler = new(DIDMethod)
|
||||
|
||||
// UnmarshalBinary implements encoding.BinaryUnmarshaler for DIDMethod.
|
||||
func (rcv *DIDMethod) UnmarshalBinary(data []byte) error {
|
||||
switch str := string(data); str {
|
||||
case "ipfs":
|
||||
*rcv = Ipfs
|
||||
case "sonr":
|
||||
*rcv = Sonr
|
||||
case "bitcoin":
|
||||
*rcv = Bitcoin
|
||||
case "ethereum":
|
||||
*rcv = Ethereum
|
||||
case "ibc":
|
||||
*rcv = Ibc
|
||||
case "webauthn":
|
||||
*rcv = Webauthn
|
||||
case "dwn":
|
||||
*rcv = Dwn
|
||||
case "service":
|
||||
*rcv = Service
|
||||
default:
|
||||
return fmt.Errorf(`illegal: "%s" is not a valid DIDMethod`, str)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
// Code generated from Pkl module `format`. DO NOT EDIT.
|
||||
package format
|
||||
|
||||
import "github.com/apple/pkl-go/pkl"
|
||||
|
||||
func init() {
|
||||
pkl.RegisterMapping("format", Format{})
|
||||
pkl.RegisterMapping("format#Macaroon", Macaroon{})
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
// Code generated from Pkl module `models`. DO NOT EDIT.
|
||||
package models
|
||||
|
||||
type Input struct {
|
||||
Label string `pkl:"label"`
|
||||
|
||||
Type string `pkl:"type"`
|
||||
|
||||
Placeholder string `pkl:"placeholder"`
|
||||
|
||||
Value *string `pkl:"value"`
|
||||
|
||||
Error *string `pkl:"error"`
|
||||
|
||||
Help *string `pkl:"help"`
|
||||
|
||||
Required bool `pkl:"required"`
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
// Code generated from Pkl module `models`. DO NOT EDIT.
|
||||
package models
|
||||
|
||||
import "github.com/onsonr/sonr/pkg/nebula/models/formstate"
|
||||
|
||||
type RegistrationForm struct {
|
||||
Title string `pkl:"title"`
|
||||
|
||||
Description string `pkl:"description"`
|
||||
|
||||
State formstate.FormState `pkl:"state"`
|
||||
|
||||
Inputs []*Input `pkl:"inputs"`
|
||||
}
|
||||
@@ -11,5 +11,7 @@ func init() {
|
||||
pkl.RegisterMapping("models#Stats", Stats{})
|
||||
pkl.RegisterMapping("models#Link", Link{})
|
||||
pkl.RegisterMapping("models#SocialLink", SocialLink{})
|
||||
pkl.RegisterMapping("models#Input", Input{})
|
||||
pkl.RegisterMapping("models#Footer", Footer{})
|
||||
pkl.RegisterMapping("models#RegistrationForm", RegistrationForm{})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user