2024-02-23 09:44:57 +00:00
|
|
|
package model
|
|
|
|
|
2024-02-23 14:19:12 +00:00
|
|
|
import (
|
|
|
|
"fmt"
|
|
|
|
"time"
|
|
|
|
|
|
|
|
"codeflow.dananglin.me.uk/apollo/enbas/internal/utilities"
|
|
|
|
)
|
2024-02-23 09:44:57 +00:00
|
|
|
|
|
|
|
type Account struct {
|
|
|
|
Acct string `json:"acct"`
|
|
|
|
Avatar string `json:"avatar"`
|
|
|
|
AvatarStatic string `json:"avatar_static"`
|
|
|
|
CustomCSS string `json:"custom_css"`
|
2024-02-23 14:19:12 +00:00
|
|
|
Header string `json:"header"`
|
|
|
|
HeaderStatic string `json:"header_static"`
|
|
|
|
ID string `json:"id"`
|
|
|
|
LastStatusAt string `json:"last_status_at"`
|
2024-02-23 09:44:57 +00:00
|
|
|
DisplayName string `json:"display_name"`
|
|
|
|
Emojis []Emoji `json:"emojis"`
|
|
|
|
EnableRSS bool `json:"enable_rss"`
|
2024-02-23 14:19:12 +00:00
|
|
|
Bot bool `json:"bot"`
|
|
|
|
Locked bool `json:"locked"`
|
|
|
|
Suspended bool `json:"suspended"`
|
|
|
|
Discoverable bool `json:"discoverable"`
|
2024-02-23 09:44:57 +00:00
|
|
|
Fields []Field `json:"fields"`
|
|
|
|
FollowersCount int `json:"followers_count"`
|
|
|
|
FollowingCount int `json:"following_count"`
|
2024-02-23 14:19:12 +00:00
|
|
|
CreatedAt time.Time `json:"created_at"`
|
2024-02-23 09:44:57 +00:00
|
|
|
MuteExpiresAt time.Time `json:"mute_expires_at"`
|
|
|
|
Note string `json:"note"`
|
|
|
|
Role AccountRole `json:"role"`
|
|
|
|
Source Source `json:"source"`
|
|
|
|
StatusCount int `json:"statuses_count"`
|
|
|
|
URL string `json:"url"`
|
|
|
|
Username string `json:"username"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type AccountRole struct {
|
|
|
|
Name string `json:"name"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type Source struct {
|
|
|
|
Fields []Field `json:"fields"`
|
|
|
|
FollowRequestCount int `json:"follow_requests_count"`
|
|
|
|
Language string `json:"language"`
|
|
|
|
Note string `json:"note"`
|
|
|
|
Privacy string `json:"string"`
|
|
|
|
Sensitive bool `json:"sensitive"`
|
|
|
|
StatusContentType string `json:"status_content_type"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type Field struct {
|
|
|
|
Name string `json:"name"`
|
|
|
|
Value string `json:"value"`
|
|
|
|
VerifiedAt string `json:"verified_at"`
|
|
|
|
}
|
2024-02-23 14:19:12 +00:00
|
|
|
|
|
|
|
func (a Account) String() string {
|
|
|
|
format := `
|
|
|
|
%s (@%s)
|
|
|
|
|
2024-02-24 08:22:24 +00:00
|
|
|
%s
|
2024-02-23 14:19:12 +00:00
|
|
|
%s
|
|
|
|
|
2024-02-24 08:22:24 +00:00
|
|
|
%s
|
2024-02-23 14:19:12 +00:00
|
|
|
%s
|
|
|
|
|
2024-02-24 08:22:24 +00:00
|
|
|
%s
|
2024-02-24 15:53:29 +00:00
|
|
|
%s %d
|
|
|
|
%s %d
|
|
|
|
%s %d
|
2024-02-23 14:19:12 +00:00
|
|
|
|
2024-02-24 08:22:24 +00:00
|
|
|
%s
|
2024-02-23 14:19:12 +00:00
|
|
|
%s
|
|
|
|
|
2024-02-24 08:22:24 +00:00
|
|
|
%s %s
|
2024-02-23 14:19:12 +00:00
|
|
|
|
2024-02-24 08:22:24 +00:00
|
|
|
%s
|
2024-02-23 14:19:12 +00:00
|
|
|
%s
|
|
|
|
`
|
|
|
|
metadata := ""
|
|
|
|
|
|
|
|
for _, field := range a.Fields {
|
|
|
|
metadata += fmt.Sprintf(
|
|
|
|
"\n %s: %s",
|
2024-02-24 15:53:29 +00:00
|
|
|
utilities.FieldFormat(field.Name),
|
2024-02-23 14:19:12 +00:00
|
|
|
utilities.StripHTMLTags(field.Value),
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
|
|
|
return fmt.Sprintf(
|
|
|
|
format,
|
2024-02-24 15:53:29 +00:00
|
|
|
utilities.DisplayNameFormat(a.DisplayName),
|
2024-02-23 14:19:12 +00:00
|
|
|
a.Username,
|
2024-02-24 15:53:29 +00:00
|
|
|
utilities.HeaderFormat("ACCOUNT ID:"),
|
2024-02-23 14:19:12 +00:00
|
|
|
a.ID,
|
2024-02-24 15:53:29 +00:00
|
|
|
utilities.HeaderFormat("JOINED ON:"),
|
2024-02-24 11:22:57 +00:00
|
|
|
utilities.FormatDate(a.CreatedAt),
|
2024-02-24 15:53:29 +00:00
|
|
|
utilities.HeaderFormat("STATS:"),
|
|
|
|
utilities.FieldFormat("Followers:"), a.FollowersCount,
|
|
|
|
utilities.FieldFormat("Followeing:"), a.FollowingCount,
|
|
|
|
utilities.FieldFormat("Statuses:"), a.StatusCount,
|
|
|
|
utilities.HeaderFormat("BIOGRAPHY:"),
|
2024-02-23 14:19:12 +00:00
|
|
|
utilities.WrapLine(utilities.StripHTMLTags(a.Note), "\n ", 80),
|
2024-02-24 15:53:29 +00:00
|
|
|
utilities.HeaderFormat("METADATA:"),
|
2024-02-23 14:19:12 +00:00
|
|
|
metadata,
|
2024-02-24 15:53:29 +00:00
|
|
|
utilities.HeaderFormat("ACCOUNT URL:"),
|
2024-02-23 14:19:12 +00:00
|
|
|
a.URL,
|
|
|
|
)
|
|
|
|
}
|