Exemplo n.º 1
0
func ToRepository(owner *models.User, repo *models.Repository, permission api.Permission) *api.Repository {
	cl := repo.CloneLink()
	return &api.Repository{
		ID:          repo.ID,
		Owner:       ToUser(owner),
		FullName:    owner.Name + "/" + repo.Name,
		Private:     repo.IsPrivate,
		Fork:        repo.IsFork,
		HtmlUrl:     setting.AppUrl + owner.Name + "/" + repo.Name,
		CloneUrl:    cl.HTTPS,
		SshUrl:      cl.SSH,
		Permissions: permission,
	}
}
Exemplo n.º 2
0
// ToApiRepository converts repository to API format.
func ToApiRepository(owner *models.User, repo *models.Repository, permission api.Permission) *api.Repository {
	cl, err := repo.CloneLink()
	if err != nil {
		log.Error(4, "CloneLink: %v", err)
	}
	return &api.Repository{
		Id:          repo.Id,
		Owner:       *ToApiUser(owner),
		FullName:    owner.Name + "/" + repo.Name,
		Private:     repo.IsPrivate,
		Fork:        repo.IsFork,
		HtmlUrl:     setting.AppUrl + owner.Name + "/" + repo.Name,
		CloneUrl:    cl.HTTPS,
		SshUrl:      cl.SSH,
		Permissions: permission,
	}
}
Exemplo n.º 3
0
func ToRepository(owner *models.User, repo *models.Repository, permission api.Permission) *api.Repository {
	cl := repo.CloneLink()
	return &api.Repository{
		ID:          repo.ID,
		Owner:       ToUser(owner),
		FullName:    owner.Name + "/" + repo.Name,
		Description: repo.Description,
		Private:     repo.IsPrivate,
		Fork:        repo.IsFork,
		HtmlUrl:     setting.AppUrl + owner.Name + "/" + repo.Name,
		CloneUrl:    cl.HTTPS,
		SshUrl:      cl.SSH,
		OpenIssues:  repo.NumOpenIssues,
		Stars:       repo.NumStars,
		Forks:       repo.NumForks,
		Watchers:    repo.NumWatches,
		Permissions: permission,
	}
}