telegraph/get_account_info.go

28 lines
667 B
Go
Raw Normal View History

2017-09-04 21:09:59 +00:00
package telegraph
type getAccountInfo struct {
// Access token of the Telegraph account.
AccessToken string `json:"access_token"`
2017-09-04 21:09:59 +00:00
// List of account fields to return.
Fields []string `json:"fields,omitempty"`
}
2017-09-04 21:09:59 +00:00
// GetAccountInfo get information about a Telegraph account. Returns an Account object on success.
2019-07-24 08:03:29 +00:00
func (a *Account) GetAccountInfo(fields ...string) (*Account, error) {
data, err := makeRequest("getAccountInfo", getAccountInfo{
AccessToken: a.AccessToken,
Fields: fields,
})
if err != nil {
return nil, err
2019-07-24 08:03:29 +00:00
}
2017-09-04 21:09:59 +00:00
result := new(Account)
if err = parser.Unmarshal(data, result); err != nil {
2017-09-04 21:09:59 +00:00
return nil, err
}
return result, nil
2017-09-04 21:09:59 +00:00
}