1234567891011121314151617181920212223 |
- package gogs
- import (
- "fmt"
- )
- func (c *Client) GetFile(user, repo, ref, tree string) ([]byte, error) {
- return c.getResponse("GET", fmt.Sprintf("/repos/%s/%s/raw/%s/%s", user, repo, ref, tree), nil, nil)
- }
- func (c *Client) GetArchive(user, repo, ref, format string) ([]byte, error) {
- if format != ".zip" && format != ".tar.gz" {
- return nil, fmt.Errorf("invalid format: %s (must be .zip or .tar.gz)", format)
- }
- return c.getResponse("GET", fmt.Sprintf("/repos/%s/%s/archive/%s%s", user, repo, ref, format), nil, nil)
- }
|