(project *Project, description, homepage string, isPrivate bool)
| 221 | } |
| 222 | |
| 223 | func (client *Client) CreateRepository(project *Project, description, homepage string, isPrivate bool) (repo *Repository, err error) { |
| 224 | repoURL := "user/repos" |
| 225 | if project.Owner != client.Host.User { |
| 226 | repoURL = fmt.Sprintf("orgs/%s/repos", project.Owner) |
| 227 | } |
| 228 | |
| 229 | params := map[string]interface{}{ |
| 230 | "name": project.Name, |
| 231 | "description": description, |
| 232 | "homepage": homepage, |
| 233 | "private": isPrivate, |
| 234 | } |
| 235 | |
| 236 | api, err := client.simpleApi() |
| 237 | if err != nil { |
| 238 | return |
| 239 | } |
| 240 | |
| 241 | res, err := api.PostJSON(repoURL, params) |
| 242 | if err = checkStatus(201, "creating repository", res, err); err != nil { |
| 243 | return |
| 244 | } |
| 245 | |
| 246 | repo = &Repository{} |
| 247 | err = res.Unmarshal(repo) |
| 248 | return |
| 249 | } |
| 250 | |
| 251 | func (client *Client) DeleteRepository(project *Project) error { |
| 252 | api, err := client.simpleApi() |
no test coverage detected