diff options
author | Richard Mahn <richmahn@users.noreply.github.com> | 2019-03-22 09:38:49 -0600 |
---|---|---|
committer | techknowlogick <matti@mdranta.net> | 2019-03-22 11:38:49 -0400 |
commit | ecce28f9dfaaa78a8471053ca40716a1e426aa6f (patch) | |
tree | 0fa497785e4116bd4086d63c666f223883a49253 /vendor/code.gitea.io | |
parent | 03e4db40cc09d6c211b3026f743c38c227e4fc8e (diff) | |
download | gitea-ecce28f9dfaaa78a8471053ca40716a1e426aa6f.tar.gz gitea-ecce28f9dfaaa78a8471053ca40716a1e426aa6f.zip |
Updates SDK dep (#6406)
Diffstat (limited to 'vendor/code.gitea.io')
-rw-r--r-- | vendor/code.gitea.io/sdk/gitea/git_blob.go | 14 | ||||
-rw-r--r-- | vendor/code.gitea.io/sdk/gitea/repo_commit.go | 12 | ||||
-rw-r--r-- | vendor/code.gitea.io/sdk/gitea/repo_file.go | 75 |
3 files changed, 98 insertions, 3 deletions
diff --git a/vendor/code.gitea.io/sdk/gitea/git_blob.go b/vendor/code.gitea.io/sdk/gitea/git_blob.go new file mode 100644 index 0000000000..abdd95aaff --- /dev/null +++ b/vendor/code.gitea.io/sdk/gitea/git_blob.go @@ -0,0 +1,14 @@ +// Copyright 2019 The Gitea Authors. All rights reserved. +// Use of this source code is governed by a MIT-style +// license that can be found in the LICENSE file. + +package gitea + +// GitBlobResponse represents a git blob +type GitBlobResponse struct { + Content string `json:"content"` + Encoding string `json:"encoding"` + URL string `json:"url"` + SHA string `json:"sha"` + Size int64 `json:"size"` +} diff --git a/vendor/code.gitea.io/sdk/gitea/repo_commit.go b/vendor/code.gitea.io/sdk/gitea/repo_commit.go index 2954f9fc1c..74c52c06fb 100644 --- a/vendor/code.gitea.io/sdk/gitea/repo_commit.go +++ b/vendor/code.gitea.io/sdk/gitea/repo_commit.go @@ -9,6 +9,13 @@ import ( "fmt" ) +// Identity for a person's identity like an author or committer +type Identity struct { + Name string `json:"name" binding:"MaxSize(100)"` + // swagger:strfmt email + Email string `json:"email" binding:"MaxSize(254)"` +} + // CommitMeta contains meta information of a commit in terms of API. type CommitMeta struct { URL string `json:"url"` @@ -17,9 +24,8 @@ type CommitMeta struct { // CommitUser contains information of a user in the context of a commit. type CommitUser struct { - Name string `json:"name"` - Email string `json:"email"` - Date string `json:"date"` + Identity + Date string `json:"date"` } // RepoCommit contains information of a commit in the context of a repository. diff --git a/vendor/code.gitea.io/sdk/gitea/repo_file.go b/vendor/code.gitea.io/sdk/gitea/repo_file.go index e6c89f0c0f..1e9e45ec24 100644 --- a/vendor/code.gitea.io/sdk/gitea/repo_file.go +++ b/vendor/code.gitea.io/sdk/gitea/repo_file.go @@ -1,4 +1,5 @@ // Copyright 2014 The Gogs Authors. All rights reserved. +// Copyright 2019 The Gitea Authors. All rights reserved. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. @@ -13,3 +14,77 @@ import ( func (c *Client) GetFile(user, repo, ref, tree string) ([]byte, error) { return c.getResponse("GET", fmt.Sprintf("/repos/%s/%s/raw/%s/%s", user, repo, ref, tree), nil, nil) } + +// 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"` +} + +// CreateFileOptions options for creating files +type CreateFileOptions struct { + FileOptions + Content string `json:"content"` +} + +// DeleteFileOptions options for deleting files (used for other File structs below) +type DeleteFileOptions struct { + FileOptions + SHA string `json:"sha" binding:"Required"` +} + +// UpdateFileOptions options for updating files +type UpdateFileOptions struct { + DeleteFileOptions + Content string `json:"content"` + FromPath string `json:"from_path" binding:"MaxSize(500)"` +} + +// FileLinksResponse contains the links for a repo's file +type FileLinksResponse struct { + Self string `json:"url"` + GitURL string `json:"git_url"` + HTMLURL string `json:"html_url"` +} + +// FileContentResponse contains information about a repo's file stats and content +type FileContentResponse struct { + Name string `json:"name"` + Path string `json:"path"` + SHA string `json:"sha"` + Size int64 `json:"size"` + URL string `json:"url"` + HTMLURL string `json:"html_url"` + GitURL string `json:"git_url"` + DownloadURL string `json:"download_url"` + Type string `json:"type"` + Links *FileLinksResponse `json:"_links"` +} + +// FileCommitResponse contains information generated from a Git commit for a repo's file. +type FileCommitResponse struct { + CommitMeta + HTMLURL string `json:"html_url"` + Author *CommitUser `json:"author"` + Committer *CommitUser `json:"committer"` + Parents []*CommitMeta `json:"parents"` + Message string `json:"message"` + Tree *CommitMeta `json:"tree"` +} + +// FileResponse contains information about a repo's file +type FileResponse struct { + Content *FileContentResponse `json:"content"` + 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 + Commit *FileCommitResponse `json:"commit"` + Verification *PayloadCommitVerification `json:"verification"` +} |