add method to lookup accounts by username
This commit is contained in:
parent
3e88d9bc55
commit
7310a9e2f2
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue
Block a user