summaryrefslogtreecommitdiffstats
path: root/modules/structs/repo_file.go
diff options
context:
space:
mode:
authorRichard Mahn <richmahn@users.noreply.github.com>2019-06-29 16:51:10 -0400
committertechknowlogick <techknowlogick@gitea.io>2019-06-29 16:51:10 -0400
commitcd96dee9822c8b744526ba862fd8b5ec0e2c30ff (patch)
treed7bbf2f2b7adf80b17f3ab3971ae49bae7b010c4 /modules/structs/repo_file.go
parent738285a4aac5df2e60f4038aa79be3e9fe921bdb (diff)
downloadgitea-cd96dee9822c8b744526ba862fd8b5ec0e2c30ff.tar.gz
gitea-cd96dee9822c8b744526ba862fd8b5ec0e2c30ff.zip
Fixes #7292 - API File Contents bug (#7301)
Diffstat (limited to 'modules/structs/repo_file.go')
-rw-r--r--modules/structs/repo_file.go41
1 files changed, 25 insertions, 16 deletions
diff --git a/modules/structs/repo_file.go b/modules/structs/repo_file.go
index e5be9ce108..b2eeb7f13a 100644
--- a/modules/structs/repo_file.go
+++ b/modules/structs/repo_file.go
@@ -49,23 +49,32 @@ type UpdateFileOptions struct {
// 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"`
+ Self *string `json:"self"`
+ GitURL *string `json:"git"`
+ HTMLURL *string `json:"html"`
}
-// 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"`
+// ContentsResponse contains information about a repo's entry's (dir, file, symlink, submodule) metadata and content
+type ContentsResponse struct {
+ Name string `json:"name"`
+ Path string `json:"path"`
+ SHA string `json:"sha"`
+ // `type` will be `file`, `dir`, `symlink`, or `submodule`
+ Type string `json:"type"`
+ Size int64 `json:"size"`
+ // `encoding` is populated when `type` is `file`, otherwise null
+ Encoding *string `json:"encoding"`
+ // `content` is populated when `type` is `file`, otherwise null
+ Content *string `json:"content"`
+ // `target` is populated when `type` is `symlink`, otherwise null
+ Target *string `json:"target"`
+ URL *string `json:"url"`
+ HTMLURL *string `json:"html_url"`
+ GitURL *string `json:"git_url"`
+ DownloadURL *string `json:"download_url"`
+ // `submodule_git_url` is populated when `type` is `submodule`, otherwise null
+ SubmoduleGitURL *string `json:"submodule_git_url"`
+ Links *FileLinksResponse `json:"_links"`
}
// FileCommitResponse contains information generated from a Git commit for a repo's file.
@@ -81,7 +90,7 @@ type FileCommitResponse struct {
// FileResponse contains information about a repo's file
type FileResponse struct {
- Content *FileContentResponse `json:"content"`
+ Content *ContentsResponse `json:"content"`
Commit *FileCommitResponse `json:"commit"`
Verification *PayloadCommitVerification `json:"verification"`
}