summaryrefslogtreecommitdiffstats
path: root/modules/structs/repo_file.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/structs/repo_file.go')
-rw-r--r--modules/structs/repo_file.go26
1 files changed, 20 insertions, 6 deletions
diff --git a/modules/structs/repo_file.go b/modules/structs/repo_file.go
index ac8b9333fe..c447d26724 100644
--- a/modules/structs/repo_file.go
+++ b/modules/structs/repo_file.go
@@ -7,29 +7,43 @@ package structs
// FileOptions options for all file APIs
type FileOptions struct {
- Message string `json:"message" binding:"Required"`
- BranchName string `json:"branch"`
- NewBranchName string `json:"new_branch"`
- Author Identity `json:"author"`
- Committer Identity `json:"committer"`
+ // message (optional) for the commit of this file. if not supplied, a default message will be used
+ Message string `json:"message" binding:"Required"`
+ // branch (optional) to base this file from. if not given, the default branch is used
+ BranchName string `json:"branch"`
+ // new_branch (optional) will make a new branch from `branch` before creating the file
+ NewBranchName string `json:"new_branch"`
+ // `author` and `committer` are optional (if only one is given, it will be used for the other, otherwise the authenticated user will be used)
+ Author Identity `json:"author"`
+ Committer Identity `json:"committer"`
}
// CreateFileOptions options for creating files
+// Note: `author` and `committer` are optional (if only one is given, it will be used for the other, otherwise the authenticated user will be used)
type CreateFileOptions struct {
FileOptions
+ // content must be base64 encoded
+ // required: true
Content string `json:"content"`
}
// DeleteFileOptions options for deleting files (used for other File structs below)
+// Note: `author` and `committer` are optional (if only one is given, it will be used for the other, otherwise the authenticated user will be used)
type DeleteFileOptions struct {
FileOptions
+ // sha is the SHA for the file that already exists
+ // required: true
SHA string `json:"sha" binding:"Required"`
}
// UpdateFileOptions options for updating files
+// Note: `author` and `committer` are optional (if only one is given, it will be used for the other, otherwise the authenticated user will be used)
type UpdateFileOptions struct {
DeleteFileOptions
- Content string `json:"content"`
+ // content must be base64 encoded
+ // required: true
+ Content string `json:"content"`
+ // from_path (optional) is the path of the original file which will be moved/renamed to the path in the URL
FromPath string `json:"from_path" binding:"MaxSize(500)"`
}