From 1a807bb4387bc36be178f3cc9677e21c94e0d00f Mon Sep 17 00:00:00 2001 From: Yonah Date: Mon, 20 Apr 2026 21:56:45 +0900 Subject: [PATCH 1/2] meta: wrap url type This represents the URL cleanly during serialisation. Signed-off-by: Yonah --- meta/meta.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 meta/meta.go diff --git a/meta/meta.go b/meta/meta.go new file mode 100644 index 0000000..84e1410 --- /dev/null +++ b/meta/meta.go @@ -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) } -- 2.51.2 From f44d93cb3bcaee9ee2d0797c32e006e51b8573af Mon Sep 17 00:00:00 2001 From: Yonah Date: Mon, 20 Apr 2026 22:00:45 +0900 Subject: [PATCH 2/2] meta: member and system metadata This is still a work-in-progress requiring further discussion. Signed-off-by: Yonah --- meta/member.go | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 meta/member.go diff --git a/meta/member.go b/meta/member.go new file mode 100644 index 0000000..694acce --- /dev/null +++ b/meta/member.go @@ -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 +} -- 2.51.2