diff --git a/build.go b/build.go index fa29585..1fc7e1f 100644 --- a/build.go +++ b/build.go @@ -79,15 +79,20 @@ type Build struct { } type ArtifactCollection struct { - Count int `json:"count"` - Files []Artifact `json:"file"` + Count int `json:"count"` + Files []*Artifact `json:"file"` } type Artifact struct { - Size int `json:"size"` - ModificationTime string `json:"modificationTime"` - Name string `json:"name"` - HREF string `json:"href"` + Size int `json:"size"` + ModificationTime string `json:"modificationTime"` + Name string `json:"name"` + HREF string `json:"href"` + Content *ArtifactContent `json:"content"` +} + +type ArtifactContent struct { + HREF string `json:"href"` } type oneProperty struct { diff --git a/client.go b/client.go index cb69842..b912389 100644 --- a/client.go +++ b/client.go @@ -236,14 +236,14 @@ func (c *Client) GetArtifacts(build *Build) (ArtifactCollection, error) { return artifacts, err } -func (c *Client) GetArtifact(artifact *Artifact) (io.Reader, error) { - authURL := fmt.Sprintf("https://%s%s", c.host, artifact.HREF) +func (c *Client) GetArtifact(artifact *ArtifactContent) (io.Reader, error) { + authURL := c.addProtocol(artifact.HREF) fmt.Printf("Sending request to %s\n", authURL) var body io.Reader - req, _ := http.NewRequest(method, authURL, body) + req, _ := http.NewRequest("GET", authURL, body) req.SetBasicAuth(c.username, c.password) req.Header.Add("Accept", "application/json")