2023-09-26 05:29:10 +00:00
|
|
|
package ent
|
2023-09-26 04:26:53 +00:00
|
|
|
|
|
|
|
import (
|
|
|
|
|
2024-08-01 22:29:50 +00:00
|
|
|
"github.com/reiver/go-opt"
|
2024-08-01 23:59:52 +00:00
|
|
|
"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),
|
|
|
|
}
|
|
|
|
}
|