summaryrefslogtreecommitdiffstats
path: root/modules/structs
diff options
context:
space:
mode:
authorRichard Mahn <richmahn@users.noreply.github.com>2019-05-30 11:09:05 -0400
committertechknowlogick <hello@techknowlogick.com>2019-05-30 11:09:05 -0400
commit1831b3b57144e87ccfc4f6322eefc88a49b2300e (patch)
tree225fa569e3908c153683009d0d75c42f9dacc956 /modules/structs
parentcdd10f145be0b5e9b94c19f1303dc01c6e9c8c29 (diff)
downloadgitea-1831b3b57144e87ccfc4f6322eefc88a49b2300e.tar.gz
gitea-1831b3b57144e87ccfc4f6322eefc88a49b2300e.zip
Fixes #5960 - Adds API Endpoint for Repo Edit (#7006)
* Feature - #5960 - API Endpoint for Repo Editing * Revert from merge * Adds integration testing * Updates to integration tests * Revert changes * Update year in file header * Misspell fix * XORM = test * XORM = test * revert XORM = file * Makes RepoUnit.ID be pk and autoincr * Fix to units * revert header * Remove print statement * Adds other responses * Improves swagger for creating repo * Fixes import order * Better Unit Type does not exist error * Adds editable repo properties to the response repo structure * Fix to api_repo_edit_test.go * Fixes repo test * Changes per review * Fixes typo and standardizes comments in the EditRepoOption struct for swagger * Fixes typo and standardizes comments in the EditRepoOption struct for swagger * Actually can unarchive through the API * Unlike delete, user doesn't have to be the owner of the org, just admin to the repo * Fix to swagger comments for field name change * Update to swagger docs * Update swagger * Changes allow_pull_requests to has_pull_requests
Diffstat (limited to 'modules/structs')
-rw-r--r--modules/structs/repo.go58
1 files changed, 32 insertions, 26 deletions
diff --git a/modules/structs/repo.go b/modules/structs/repo.go
index 19f5ff8afe..b4d162b776 100644
--- a/modules/structs/repo.go
+++ b/modules/structs/repo.go
@@ -41,9 +41,17 @@ type Repository struct {
// swagger:strfmt date-time
Created time.Time `json:"created_at"`
// swagger:strfmt date-time
- Updated time.Time `json:"updated_at"`
- Permissions *Permission `json:"permissions,omitempty"`
- AvatarURL string `json:"avatar_url"`
+ Updated time.Time `json:"updated_at"`
+ Permissions *Permission `json:"permissions,omitempty"`
+ HasIssues bool `json:"has_issues"`
+ HasWiki bool `json:"has_wiki"`
+ HasPullRequests bool `json:"has_pull_requests"`
+ IgnoreWhitespaceConflicts bool `json:"ignore_whitespace_conflicts"`
+ AllowMerge bool `json:"allow_merge_commits"`
+ AllowRebase bool `json:"allow_rebase"`
+ AllowRebaseMerge bool `json:"allow_rebase_explicit"`
+ AllowSquash bool `json:"allow_squash_merge"`
+ AvatarURL string `json:"avatar_url"`
}
// CreateRepoOption options when creating repository
@@ -71,38 +79,36 @@ type CreateRepoOption struct {
// EditRepoOption options when editing a repository's properties
// swagger:model
type EditRepoOption struct {
- // Name of the repository
- //
- // required: true
+ // name of the repository
// unique: true
- Name *string `json:"name" binding:"Required;AlphaDashDot;MaxSize(100)"`
- // A short description of the repository.
+ Name *string `json:"name,omitempty" binding:"OmitEmpty;AlphaDashDot;MaxSize(100);"`
+ // a short description of the repository.
Description *string `json:"description,omitempty" binding:"MaxSize(255)"`
- // A URL with more information about the repository.
+ // a URL with more information about the repository.
Website *string `json:"website,omitempty" binding:"MaxSize(255)"`
- // Either `true` to make the repository private or `false` to make it public.
- // Note: You will get a 422 error if the organization restricts changing repository visibility to organization
+ // either `true` to make the repository private or `false` to make it public.
+ // Note: you will get a 422 error if the organization restricts changing repository visibility to organization
// owners and a non-owner tries to change the value of private.
Private *bool `json:"private,omitempty"`
- // Either `true` to enable issues for this repository or `false` to disable them.
- EnableIssues *bool `json:"enable_issues,omitempty"`
- // Either `true` to enable the wiki for this repository or `false` to disable it.
- EnableWiki *bool `json:"enable_wiki,omitempty"`
- // Updates the default branch for this repository.
+ // either `true` to enable issues for this repository or `false` to disable them.
+ HasIssues *bool `json:"has_issues,omitempty"`
+ // either `true` to enable the wiki for this repository or `false` to disable it.
+ HasWiki *bool `json:"has_wiki,omitempty"`
+ // sets the default branch for this repository.
DefaultBranch *string `json:"default_branch,omitempty"`
- // Either `true` to allow pull requests, or `false` to prevent pull request.
- EnablePullRequests *bool `json:"enable_pull_requests,omitempty"`
- // Either `true` to ignore whitepace for conflicts, or `false` to not ignore whitespace. `enabled_pull_requests` must be `true`.
- IgnoreWhitespaceConflicts *bool `json:"ignore_whitespace,omitempty"`
- // Either `true` to allow merging pull requests with a merge commit, or `false` to prevent merging pull requests with merge commits. `enabled_pull_requests` must be `true`.
+ // either `true` to allow pull requests, or `false` to prevent pull request.
+ HasPullRequests *bool `json:"has_pull_requests,omitempty"`
+ // either `true` to ignore whitespace for conflicts, or `false` to not ignore whitespace. `has_pull_requests` must be `true`.
+ IgnoreWhitespaceConflicts *bool `json:"ignore_whitespace_conflicts,omitempty"`
+ // either `true` to allow merging pull requests with a merge commit, or `false` to prevent merging pull requests with merge commits. `has_pull_requests` must be `true`.
AllowMerge *bool `json:"allow_merge_commits,omitempty"`
- // Either `true` to allow rebase-merging pull requests, or `false` to prevent rebase-merging. `enabled_pull_requests` must be `true`.
+ // either `true` to allow rebase-merging pull requests, or `false` to prevent rebase-merging. `has_pull_requests` must be `true`.
AllowRebase *bool `json:"allow_rebase,omitempty"`
- // Either `true` to allow rebase with explicit merge commits (--no-ff), or `false` to prevent rebase with explicit merge commits. `enabled_pull_requests` must be `true`.
+ // either `true` to allow rebase with explicit merge commits (--no-ff), or `false` to prevent rebase with explicit merge commits. `has_pull_requests` must be `true`.
AllowRebaseMerge *bool `json:"allow_rebase_explicit,omitempty"`
- // Either `true` to allow squash-merging pull requests, or `false` to prevent squash-merging. `enabled_pull_requests` must be `true`.
- AllowSquashMerge *bool `json:"allow_squash_merge,omitempty"`
- // `true` to archive this repository. Note: You cannot unarchive repositories through the API.
+ // either `true` to allow squash-merging pull requests, or `false` to prevent squash-merging. `has_pull_requests` must be `true`.
+ AllowSquash *bool `json:"allow_squash_merge,omitempty"`
+ // set to `true` to archive this repository.
Archived *bool `json:"archived,omitempty"`
}