goharbor / go-client

Client library with golang for accessing Harbor API.
Apache License 2.0
39 stars 18 forks source link

get V2() client should wrap basePath automatically #4

Closed chlins closed 2 years ago

chlins commented 2 years ago

harborClient.V2() will return a client without basePath, and if call sdk methods will cause error(404/405 ...).

maybe can wrap like this.

func (c *Config) ToV2Config() v2client.Config {
    return v2client.Config{
        URL:       c.URL + "/v2.0/api",
        Transport: insecureTransport,
        AuthInfo:  c.AuthInfo,
    }
}