Skip to content

Commit 6a8e990

Browse files
author
Menghong Li
committed
Get list of forks
1 parent b5def9f commit 6a8e990

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

lib/bitbucket_rest_api/repos/forks.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,23 @@ class Repos::Forks < API
2626
scm
2727
].freeze
2828

29+
# List forks of a repo
30+
#
31+
# = Examples
32+
# bitbucket = BitBucket.new
33+
# bitbucket.repos.forks.list 'user-name', 'repo-name'
34+
# bitbucket.repos.forks.list 'user-name', 'repo-name' { |fork| ... }
35+
#
36+
def list(user_name, repo_name, params={})
37+
_update_user_repo_params(user_name, repo_name)
38+
_validate_user_repo_params(user, repo) unless user? && repo?
39+
normalize! params
40+
41+
response = get_request("/2.0/repositories/#{user}/#{repo.downcase}/forks/", params)
42+
return response unless block_given?
43+
response.each { |el| yield el }
44+
end
45+
alias :all :list
2946

3047
# Create a fork
3148
#

0 commit comments

Comments
 (0)