pip compatible server to serve Python packages out of GitHub
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

31 lines
453 B

package pypihub
import (
"fmt"
"io"
)
type Asset struct {
ID int
Name string
Owner string
Repo string
Ref string
Format string
}
func (a Asset) String() string {
return a.Name
}
func (a Asset) URL() string {
return fmt.Sprintf("/%s/%s/%s", a.Owner, a.Repo, a.Name)
}
func (a Asset) Download(c *Client) (io.ReadCloser, error) {
if a.Ref != "" && a.Format != "" {
return c.DownloadArchive(a)
}
return c.DownloadAsset(a)
}