diff --git a/gitea/git_blob.go b/gitea/git_blob.go new file mode 100644 index 0000000..2843bc3 --- /dev/null +++ b/gitea/git_blob.go @@ -0,0 +1,24 @@ +// Copyright 2020 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 + +import ( + "fmt" +) + +// 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"` +} + +// GetBlob get the blob of a repository file +func (c *Client) GetBlob(user, repo, sha string) (*GitBlobResponse, error) { + blob := new(GitBlobResponse) + return blob, c.getParsedResponse("GET", fmt.Sprintf("/repos/%s/%s/git/blobs/%s", user, repo, sha), nil, nil, blob) +} diff --git a/gitea/repo_topics.go b/gitea/repo_topics.go index 1276a53..5850568 100644 --- a/gitea/repo_topics.go +++ b/gitea/repo_topics.go @@ -1,4 +1,4 @@ -// Copyright 2016 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.