Skip to content

Commit 0561927

Browse files
mfb2ktrysmt
authored andcommitted
List files by path (#72)
Adds the ability to list files along a given path in Bitbucket.
1 parent 731aa0b commit 0561927

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

bitbucket.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ type RepositoryFilesOptions struct {
121121
Owner string `json:"owner"`
122122
RepoSlug string `json:"repo_slug"`
123123
Ref string `json:"ref"`
124+
Path string `json:"path"`
124125
}
125126

126127
type RepositoryBlobOptions struct {

repository.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ func (r *Repository) Get(ro *RepositoryOptions) (*Repository, error) {
104104
}
105105

106106
func (r *Repository) ListFiles(ro *RepositoryFilesOptions) ([]RepositoryFile, error) {
107-
filePath := path.Join("/repositories", ro.Owner, ro.RepoSlug, "src")
107+
filePath := path.Join("/repositories", ro.Owner, ro.RepoSlug, "src", ro.Ref, ro.Path) + "/"
108108
urlStr := r.c.requestUrl(filePath)
109109
response, err := r.c.execute("GET", urlStr, "")
110110
if err != nil {

0 commit comments

Comments
 (0)