Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
f44d93cb3b
|
|||
|
1a807bb438
|
54
meta/member.go
Normal file
54
meta/member.go
Normal file
@@ -0,0 +1,54 @@
|
||||
package meta
|
||||
|
||||
import (
|
||||
"image/color"
|
||||
"time"
|
||||
)
|
||||
|
||||
// Common holds profile fields common between [System] and [Member].
|
||||
type Common struct {
|
||||
// Display name.
|
||||
Name string `json:"name"`
|
||||
// Optional description text, uninterpreted.
|
||||
Description string `json:"description,omitempty"`
|
||||
// Optional preferred pronouns, uninterpreted.
|
||||
Pronouns string `json:"pronouns,omitempty"`
|
||||
// Profile picture. The zero value implies the system profile picture.
|
||||
Picture *URL `json:"picture,omitempty"`
|
||||
// Optional preferred accent color.
|
||||
Color *color.CMYK `json:"color,omitempty"`
|
||||
|
||||
// TODO(ophestra): pluralkit fields represented separately:
|
||||
// id
|
||||
// uuid
|
||||
// created
|
||||
// TODO(ophestra): unimplemented pluralkit fields:
|
||||
// banner
|
||||
// privacy
|
||||
}
|
||||
|
||||
// Member describes a system member.
|
||||
type Member struct {
|
||||
Common
|
||||
|
||||
// Mutable short name, unique to the [System].
|
||||
Handle string `json:"handle"`
|
||||
// Optional preferred birthday.
|
||||
Birthday time.Time `json:"birthday,omitempty"`
|
||||
|
||||
// TODO(ophestra): unimplemented pluralkit fields:
|
||||
// keep_proxy
|
||||
// tts
|
||||
// autoproxy_enabled
|
||||
// message_count
|
||||
// last_message_timestamp
|
||||
// proxy_tags
|
||||
}
|
||||
|
||||
// System describes a system and its members.
|
||||
type System struct {
|
||||
Common
|
||||
|
||||
// TODO(ophestra): unimplemented pluralkit fields:
|
||||
// tag
|
||||
}
|
||||
20
meta/meta.go
Normal file
20
meta/meta.go
Normal file
@@ -0,0 +1,20 @@
|
||||
// Package meta defines system and member metadata types.
|
||||
package meta
|
||||
|
||||
import (
|
||||
"encoding"
|
||||
"net/url"
|
||||
)
|
||||
|
||||
// URL implements [encoding] interfaces on top of [url.URL].
|
||||
type URL struct{ url.URL }
|
||||
|
||||
var (
|
||||
_ encoding.TextAppender = new(URL)
|
||||
_ encoding.TextMarshaler = new(URL)
|
||||
_ encoding.TextUnmarshaler = new(URL)
|
||||
)
|
||||
|
||||
func (u *URL) MarshalText() (data []byte, err error) { return u.MarshalBinary() }
|
||||
func (u *URL) AppendText(data []byte) ([]byte, error) { return u.AppendBinary(data) }
|
||||
func (u *URL) UnmarshalText(data []byte) error { return u.UnmarshalBinary(data) }
|
||||
Reference in New Issue
Block a user