notfall/vendor/github.com/sms77io/go-client/sms77api/balance.go
kekskurse c9ab16b493
Some checks failed
continuous-integration/drone/push Build is failing
SMS
2022-01-16 13:30:48 +01:00

27 lines
469 B
Go

package sms77api
import (
"context"
"strconv"
)
type BalanceResource resource
func (api *BalanceResource) Get() (*float64, error) {
return api.GetContext(context.Background())
}
func (api *BalanceResource) GetContext(ctx context.Context) (*float64, error) {
res, err := api.client.request(ctx, "balance", "GET", nil)
if err != nil {
return nil, err
}
float, err := strconv.ParseFloat(res, 64)
if err != nil {
return nil, err
}
return &float, nil
}