mirror of
https://github.com/go-gitea/gitea.git
synced 2026-09-19 23:22:57 +02:00
Merge remote-tracking branch 'upstream/main' into limit-repo-size
Signed-off-by: DmitryFrolovTri <23313323+DmitryFrolovTri@users.noreply.github.com>
This commit is contained in:
@@ -64,6 +64,37 @@ func (o *UpdateFileOptions) Branch() string {
|
||||
return o.FileOptions.BranchName
|
||||
}
|
||||
|
||||
// ChangeFileOperation for creating, updating or deleting a file
|
||||
type ChangeFileOperation struct {
|
||||
// indicates what to do with the file
|
||||
// required: true
|
||||
// enum: create,update,delete
|
||||
Operation string `json:"operation" binding:"Required"`
|
||||
// path to the existing or new file
|
||||
// required: true
|
||||
Path string `json:"path" binding:"Required;MaxSize(500)"`
|
||||
// new or updated file content, must be base64 encoded
|
||||
Content string `json:"content"`
|
||||
// sha is the SHA for the file that already exists, required for update or delete
|
||||
SHA string `json:"sha"`
|
||||
// old path of the file to move
|
||||
FromPath string `json:"from_path"`
|
||||
}
|
||||
|
||||
// ChangeFilesOptions options for creating, updating or deleting multiple 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 ChangeFilesOptions struct {
|
||||
FileOptions
|
||||
// list of file operations
|
||||
// required: true
|
||||
Files []*ChangeFileOperation `json:"files" binding:"Required"`
|
||||
}
|
||||
|
||||
// Branch returns branch name
|
||||
func (o *ChangeFilesOptions) Branch() string {
|
||||
return o.FileOptions.BranchName
|
||||
}
|
||||
|
||||
// FileOptionInterface provides a unified interface for the different file options
|
||||
type FileOptionInterface interface {
|
||||
Branch() string
|
||||
@@ -126,6 +157,13 @@ type FileResponse struct {
|
||||
Verification *PayloadCommitVerification `json:"verification"`
|
||||
}
|
||||
|
||||
// FilesResponse contains information about multiple files from a repo
|
||||
type FilesResponse struct {
|
||||
Files []*ContentsResponse `json:"files"`
|
||||
Commit *FileCommitResponse `json:"commit"`
|
||||
Verification *PayloadCommitVerification `json:"verification"`
|
||||
}
|
||||
|
||||
// FileDeleteResponse contains information about a repo's file that was deleted
|
||||
type FileDeleteResponse struct {
|
||||
Content interface{} `json:"content"` // to be set to nil
|
||||
|
||||
Reference in New Issue
Block a user