version.go 404 B

123456789101112131415161718192021222324252627282930
  1. package client
  2. import (
  3. "fmt"
  4. "net/url"
  5. )
  6. const (
  7. versionUrl = "/ds/api/version"
  8. )
  9. func (c *Client) Version(baseUrl string) error {
  10. fullUrl, err := url.JoinPath(baseUrl, versionUrl)
  11. if err != nil {
  12. return err
  13. }
  14. resp := new(MsgResponse)
  15. err = c.get("", fullUrl, nil, resp)
  16. if err != nil {
  17. return err
  18. }
  19. if !resp.Success {
  20. return fmt.Errorf("version: %s", resp.Msg)
  21. }
  22. return nil
  23. }