Dan Anglin
ccdd8b6530
Add a new internal printer package for printing resources to the screen or pager. With the new printer in place, most of the settings such as the pager command, colour theme, whether or not colour output is disabled, etc are defined in one place which saves us the trouble of passing an increasing number of parameters to an increasing number of Display methods throughout the code base. The old Displayer interface and associated Display methods in the model package are removed as this is now handled by the printer. The format functions in the utilities package has essentially been rewritten as methods to the Printer type. Additional changes: - All indentation when displaying information about resources (e.g. statuses, instance, accounts) are removed. - The application's build information now has colour output.
92 lines
3 KiB
Go
92 lines
3 KiB
Go
// SPDX-FileCopyrightText: 2024 Dan Anglin <d.n.i.anglin@gmail.com>
|
|
//
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
package model
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
type Account struct {
|
|
Acct string `json:"acct"`
|
|
Avatar string `json:"avatar"`
|
|
AvatarStatic string `json:"avatar_static"`
|
|
CustomCSS string `json:"custom_css"`
|
|
Header string `json:"header"`
|
|
HeaderStatic string `json:"header_static"`
|
|
ID string `json:"id"`
|
|
LastStatusAt string `json:"last_status_at"`
|
|
DisplayName string `json:"display_name"`
|
|
Emojis []Emoji `json:"emojis"`
|
|
EnableRSS bool `json:"enable_rss"`
|
|
Bot bool `json:"bot"`
|
|
Locked bool `json:"locked"`
|
|
Suspended bool `json:"suspended"`
|
|
Discoverable bool `json:"discoverable"`
|
|
HideCollections bool `json:"hide_collections"`
|
|
Fields []Field `json:"fields"`
|
|
FollowersCount int `json:"followers_count"`
|
|
FollowingCount int `json:"following_count"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
MuteExpiresAt time.Time `json:"mute_expires_at"`
|
|
Note string `json:"note"`
|
|
Role AccountRole `json:"role"`
|
|
Source Source `json:"source"`
|
|
StatusCount int `json:"statuses_count"`
|
|
Theme string `json:"theme"`
|
|
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"`
|
|
AlsoKnownAsURIs []string `json:"also_known_as_uris"`
|
|
}
|
|
|
|
type Field struct {
|
|
Name string `json:"name"`
|
|
Value string `json:"value"`
|
|
VerifiedAt string `json:"verified_at"`
|
|
}
|
|
|
|
type AccountRelationship struct {
|
|
ID string `json:"id"`
|
|
PrivateNote string `json:"note"`
|
|
BlockedBy bool `json:"blocked_by"`
|
|
Blocking bool `json:"blocking"`
|
|
DomainBlocking bool `json:"domain_blocking"`
|
|
Endorsed bool `json:"endorsed"`
|
|
FollowedBy bool `json:"followed_by"`
|
|
Following bool `json:"following"`
|
|
Muting bool `json:"muting"`
|
|
MutingNotifications bool `json:"muting_notifications"`
|
|
Notifying bool `json:"notifying"`
|
|
FollowRequested bool `json:"requested"`
|
|
FollowRequestedBy bool `json:"requested_by"`
|
|
ShowingReblogs bool `json:"showing_reblogs"`
|
|
}
|
|
|
|
type AccountListType int
|
|
|
|
const (
|
|
AccountListFollowers AccountListType = iota
|
|
AccountListFollowing
|
|
AccountListBlockedAccount
|
|
AccountListFollowRequests
|
|
)
|
|
|
|
type AccountList struct {
|
|
Type AccountListType
|
|
Accounts []Account
|
|
}
|