woodpecker/model/repo.go

71 lines
3.1 KiB
Go
Raw Normal View History

2015-09-30 01:21:17 +00:00
package model
type RepoLite struct {
Owner string `json:"owner"`
Name string `json:"name"`
FullName string `json:"full_name"`
2015-09-30 01:21:17 +00:00
Avatar string `json:"avatar_url"`
}
// Repo represents a repository.
//
// swagger:model repo
2015-09-30 01:21:17 +00:00
type Repo struct {
2016-06-14 22:20:17 +00:00
ID int64 `json:"id,omitempty" meddler:"repo_id,pk"`
UserID int64 `json:"-" meddler:"repo_user_id"`
Owner string `json:"owner" meddler:"repo_owner"`
Name string `json:"name" meddler:"repo_name"`
FullName string `json:"full_name" meddler:"repo_full_name"`
Avatar string `json:"avatar_url,omitempty" meddler:"repo_avatar"`
Link string `json:"link_url,omitempty" meddler:"repo_link"`
Kind string `json:"scm,omitempty" meddler:"repo_scm"`
Clone string `json:"clone_url,omitempty" meddler:"repo_clone"`
Branch string `json:"default_branch,omitempty" meddler:"repo_branch"`
Timeout int64 `json:"timeout,omitempty" meddler:"repo_timeout"`
2017-05-22 21:11:29 +00:00
Visibility string `json:"visibility" meddler:"repo_visibility"`
2017-07-21 15:53:11 +00:00
IsPrivate bool `json:"private" meddler:"repo_private"`
2016-06-14 22:20:17 +00:00
IsTrusted bool `json:"trusted" meddler:"repo_trusted"`
IsStarred bool `json:"starred,omitempty" meddler:"-"`
IsGated bool `json:"gated" meddler:"repo_gated"`
2017-07-21 15:53:11 +00:00
IsActive bool `json:"active" meddler:"repo_active"`
2016-06-14 22:20:17 +00:00
AllowPull bool `json:"allow_pr" meddler:"repo_allow_pr"`
AllowPush bool `json:"allow_push" meddler:"repo_allow_push"`
AllowDeploy bool `json:"allow_deploys" meddler:"repo_allow_deploys"`
AllowTag bool `json:"allow_tags" meddler:"repo_allow_tags"`
2017-05-23 10:43:58 +00:00
Counter int `json:"last_build" meddler:"repo_counter"`
2017-03-19 08:51:12 +00:00
Config string `json:"config_file" meddler:"repo_config_path"`
2016-06-14 22:20:17 +00:00
Hash string `json:"-" meddler:"repo_hash"`
2017-07-14 19:58:38 +00:00
Perm *Perm `json:"-" meddler:"-"`
2015-09-30 01:21:17 +00:00
}
2017-07-21 15:53:11 +00:00
// Update updates the repository with values from the given Repo.
func (r *Repo) Update(from *Repo) {
r.Avatar = from.Avatar
r.Link = from.Link
r.Kind = from.Kind
r.Clone = from.Clone
r.Branch = from.Branch
if from.IsPrivate != r.IsPrivate {
if from.IsPrivate {
r.Visibility = VisibilityPrivate
} else {
r.Visibility = VisibilityPublic
}
}
r.IsPrivate = from.IsPrivate
}
// RepoPatch represents a repository patch object.
type RepoPatch struct {
Config *string `json:"config_file,omitempty"`
IsTrusted *bool `json:"trusted,omitempty"`
IsGated *bool `json:"gated,omitempty"`
Timeout *int64 `json:"timeout,omitempty"`
Visibility *string `json:"visibility,omitempty"`
AllowPull *bool `json:"allow_pr,omitempty"`
AllowPush *bool `json:"allow_push,omitempty"`
AllowDeploy *bool `json:"allow_deploy,omitempty"`
AllowTag *bool `json:"allow_tag,omitempty"`
BuildCounter *int `json:"build_counter,omitempty"`
}