Merge pull request #9 from rubenv/master
Add binding for POST /repos/migrate
This commit is contained in:
commit
1030bf8f13
1 changed files with 26 additions and 0 deletions
26
repo.go
26
repo.go
|
@ -82,3 +82,29 @@ func (c *Client) DeleteRepo(owner, repo string) error {
|
|||
_, err := c.getResponse("DELETE", fmt.Sprintf("/repos/%s/%s", owner, repo), nil, nil)
|
||||
return err
|
||||
}
|
||||
|
||||
type MigrateRepoOption struct {
|
||||
CloneAddr string `json:"clone_addr" binding:"Required"`
|
||||
AuthUsername string `json:"auth_username"`
|
||||
AuthPassword string `json:"auth_password"`
|
||||
UID int `json:"uid" binding:"Required"`
|
||||
RepoName string `json:"repo_name" binding:"Required"`
|
||||
Mirror bool `json:"mirror"`
|
||||
Private bool `json:"private"`
|
||||
Description string `json:"description"`
|
||||
}
|
||||
|
||||
// MigrateRepo migrates a repository from other Git hosting sources for the
|
||||
// authenticated user.
|
||||
//
|
||||
// To migrate a repository for a organization, the authenticated user must be a
|
||||
// owner of the specified organization.
|
||||
func (c *Client) MigrateRepo(opt MigrateRepoOption) (*Repository, error) {
|
||||
body, err := json.Marshal(&opt)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
repo := new(Repository)
|
||||
return repo, c.getParsedResponse("POST", "/repos/migrate",
|
||||
http.Header{"content-type": []string{"application/json"}}, bytes.NewReader(body), repo)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue