go-mstdn/ent/field.go

34 lines
757 B
Go
Raw Normal View History

2023-09-26 05:29:10 +00:00
package ent
2023-09-26 04:26:53 +00:00
import (
"github.com/reiver/go-opt"
"github.com/reiver/go-nul"
2023-09-26 04:26:53 +00:00
)
// Field represents a Mastodon API "Field".
//
// See:
// https://docs.joinmastodon.org/entities/Field/
type Field struct {
2024-08-08 19:27:55 +00:00
Name opt.Optional[string] `json:"name,omitempty"`
Value opt.Optional[string] `json:"value,omitempty"`
2023-09-26 04:26:53 +00:00
VerifiedAt nul.Nullable[string] `json:"verified_at"`
}
func FieldNameValue(name string, value string) Field {
return Field{
Name: opt.Something(name),
Value: opt.Something(value),
2024-08-08 19:27:55 +00:00
VerifiedAt: nul.Null[string](),
2023-09-26 04:26:53 +00:00
}
}
func FieldVerifiedNameValue(when string, name string, value string) Field {
return Field{
Name: opt.Something(name),
Value: opt.Something(value),
VerifiedAt: nul.Something(when),
}
}