add method to lookup accounts by username

This commit is contained in:
gutmet 2022-11-20 22:32:23 +01:00
parent 3e88d9bc55
commit 7310a9e2f2

View File

@ -55,6 +55,15 @@ type AccountSource struct {
Fields *[]Field `json:"fields"`
}
func LookupAccount(username string) (*Account, error) {
var account Account
err := doAPI(http.MethodGet, fmt.Sprintf("api/v1/accounts/lookup?acct=%s", url.QueryEscape(username)), nil, &account, nil)
if err != nil {
return nil, err
}
return &account, nil
}
func GetAccount(id ID) (*Account, error) {
var account Account
err := doAPI(http.MethodGet, fmt.Sprintf("/api/v1/accounts/%s", url.PathEscape(string(id))), nil, &account, nil)