parse timestamp fields into time.Time

This commit is contained in:
Dan Anglin 2024-02-23 08:36:58 +00:00
parent 4cbf1d4b4d
commit db6017dccf
Signed by: dananglin
GPG key ID: 0C1D44CFBEE68638
3 changed files with 11 additions and 7 deletions

View file

@ -32,7 +32,7 @@ var accountDetailsFormat = `
ACCOUNT ID:
%s
CREATED AT:
JOINED ON:
%s
STATS:
@ -144,7 +144,7 @@ func (c *showCommand) showAccount(gts *client.Client) error {
account.DisplayName,
account.Username,
account.ID,
account.CreatedAt,
account.CreatedAt.Format("02 Jan 2006"),
account.FollowersCount,
account.FollowingCount,
account.StatusCount,

View file

@ -1,11 +1,13 @@
package model
import "time"
type Account struct {
Acct string `json:"acct"`
Avatar string `json:"avatar"`
AvatarStatic string `json:"avatar_static"`
Bot bool `json:"bot"`
CreatedAt string `json:"created_at"`
CreatedAt time.Time `json:"created_at"`
CustomCSS string `json:"custom_css"`
Discoverable bool `json:"discoverable"`
DisplayName string `json:"display_name"`
@ -19,7 +21,7 @@ type Account struct {
ID string `json:"id"`
LastStatusAt string `json:"last_status_at"`
Locked bool `json:"locked"`
MuteExpiresAt string `json:"mute_expires_at"`
MuteExpiresAt time.Time `json:"mute_expires_at"`
Note string `json:"note"`
Role AccountRole `json:"role"`
Source Source `json:"source"`

View file

@ -1,12 +1,14 @@
package model
import "time"
type Status struct {
Account Account `json:"account"`
Application Application `json:"application"`
Bookmarked bool `json:"bookmarked"`
Card Card `json:"card"`
Content string `json:"content"`
CreatedAt string `json:"created_at"`
CreatedAt time.Time `json:"created_at"`
Emojis []Emoji `json:"emojis"`
Favourited bool `json:"favourited"`
FavouritesCount int `json:"favourites_count"`
@ -61,7 +63,7 @@ type Poll struct {
Expired bool `json:"expired"`
Voted bool `json:"voted"`
Multiple bool `json:"multiple"`
ExpiredAt string `json:"expires_at"`
ExpiredAt time.Time `json:"expires_at"`
ID string `json:"id"`
OwnVotes []int `json:"own_votes"`
VotersCount int `json:"voters_count"`
@ -80,7 +82,7 @@ type StatusReblogged struct {
Bookmarked bool `json:"bookmarked"`
Card Card `json:"card"`
Content string `json:"content"`
CreatedAt string `json:"created_at"`
CreatedAt time.Time `json:"created_at"`
Emojis []Emoji `json:"emojis"`
Favourited bool `json:"favourited"`
FavouritesCount int `json:"favourites_count"`