Example #1
0
func (c *Client) DeleteRepo(proj string, name string) error {
	url := fmt.Sprintf("%s/rest/api/1.0/projects/%s/repos/%s", c.Url, proj, name)

	r, err := c.makeRequest("DELETE", url, nil)
	if err != nil {
		return err
	}
	_, err = rest.ProcessResponseBytes(r, http.StatusAccepted)
	return err
}
Example #2
0
func (c *Client) GetAllReposPage(proj string) ([]Repo, error) {
	var page RepoPage
	url := fmt.Sprintf("%s/rest/api/1.0/projects/%s/repos", c.Url, proj)

	r, err := c.makeRequest("GET", url, nil)
	if err != nil {
		return page.Values, err
	}
	err = rest.ProcessResponseEntity(r, &page, http.StatusOK)
	if err != nil {
		_, err := rest.ProcessResponseBytes(r, http.StatusNotFound)
		return nil, err
	}
	return page.Values, err
}
Example #3
0
func (c *Client) GetRepo(proj string, name string) (*Repo, error) {
	var repo Repo
	url := fmt.Sprintf("%s/rest/api/1.0/projects/%s/repos/%s", c.Url, proj, name)

	r, err := c.makeRequest("GET", url, nil)
	if err != nil {
		return &repo, err
	}
	err = rest.ProcessResponseEntity(r, &repo, http.StatusOK)
	if err != nil {
		_, err := rest.ProcessResponseBytes(r, http.StatusNotFound)
		return nil, err
	}
	return &repo, err
}