From 61705d1f2b8c5fe255df9f3070d10c9ad5b0d99c Mon Sep 17 00:00:00 2001 From: Ben Lubar Date: Sat, 20 Oct 2018 16:47:08 -0500 Subject: [PATCH] Add missing fields in Account. See https://github.com/tootsuite/documentation/blob/master/Using-the-API/API.md#account Also fixes a spurious pagination-related error. --- accounts.go | 11 +++++++++++ mastodon.go | 7 ++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/accounts.go b/accounts.go index 1e9abb3..56890f6 100644 --- a/accounts.go +++ b/accounts.go @@ -25,6 +25,17 @@ type Account struct { AvatarStatic string `json:"avatar_static"` Header string `json:"header"` HeaderStatic string `json:"header_static"` + Emojis []Emoji `json:"emojis"` + Moved *Account `json:"moved"` + Fields []Field `json:"fields"` + Bot bool `json:"bot"` +} + +// Field is a Mastodon account profile field. +type Field struct { + Name string `json:"name"` + Value string `json:"value"` + VerifiedAt time.Time `json:"verified_at"` } // GetAccount return Account. diff --git a/mastodon.go b/mastodon.go index 1ca8d6e..68db1ba 100644 --- a/mastodon.go +++ b/mastodon.go @@ -258,7 +258,12 @@ func getPaginationID(rawurl, key string) (ID, error) { return "", err } - id, err := strconv.ParseInt(u.Query().Get(key), 10, 64) + val := u.Query().Get(key) + if val == "" { + return "", nil + } + + id, err := strconv.ParseInt(val, 10, 64) if err != nil { return "", err }