parent
d95caf50ec
commit
43cf2f3b55
11 changed files with 258 additions and 40 deletions
|
@ -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)"`
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue