dnscontrol/providers/namedotcom/zones.go
Tom Limoncelli b6fd4dffd7
Cleanups: Fix many issues reported by staticcheck.io (#837)
* Lint: Fix ST1005: error strings should not be capitalized

* Cleanup: Fix a lot of staticcheck.io warnings
2020-08-30 20:38:08 -04:00

29 lines
478 B
Go

package namedotcom
import (
"github.com/namedotcom/go/namecom"
)
// ListZones returns all the zones in an account
func (c *NameCom) ListZones() ([]string, error) {
var names []string
var page int32
for {
n, err := c.client.ListDomains(&namecom.ListDomainsRequest{Page: page})
if err != nil {
return nil, err
}
page = n.NextPage
for _, j := range n.Domains {
names = append(names, j.DomainName)
}
if page == 0 {
break
}
}
return names, nil
}