File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ package perfops
1616import (
1717 "context"
1818 "net/http"
19+ "reflect"
1920)
2021
2122type (
@@ -24,15 +25,21 @@ type (
2425)
2526
2627// RemainingCredits retrieves the ramining credits from the server.
27- func (s * DNSService ) RemainingCredits (ctx context.Context ) (int , error ) {
28+ func (s * DNSService ) RemainingCredits (ctx context.Context ) (interface {} , error ) {
2829 u := s .client .BasePath + "/remaining-credits"
2930 req , _ := http .NewRequest ("GET" , u , nil )
3031 var v * struct {
31- Val int `json:"remaining_credits"`
32+ Val interface {} `json:"remaining_credits"`
3233 }
3334 err := s .client .do (req , & v )
3435 if err != nil {
3536 return 0 , err
3637 }
37- return v .Val , nil
38+
39+ credits := v .Val
40+ if "float64" == reflect .TypeOf (v .Val ).String () {
41+ credits = int (v .Val .(float64 ))
42+ }
43+
44+ return credits , nil
3845}
You can’t perform that action at this time.
0 commit comments