Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose user_starred_projects API endpoint #584

Merged
merged 1 commit into from
Oct 1, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions lib/gitlab/client/projects.rb
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,25 @@ def unstar_project(id)
delete("/projects/#{url_encode id}/star")
end

# Get a list of visible projects that the given user has starred.
# @see https://docs.gitlab.com/ee/api/projects.html#list-projects-starred-by-a-user
#
# @example
# Gitlab.user_starred_projects(1)
# Gitlab.user_starred_projects(1, { order_by: 'last_activity_at' })
# Gitlab.user_starred_projects('username', { order_by: 'name', sort: 'asc' })
#
# @param [Integer, String] user_id The ID or username of the user.
# @param [Hash] options A customizable set of options.
# @option options [String] :per_page Number of projects to return per page
# @option options [String] :page The page to retrieve
# @option options [String] :order_by Return projects ordered by id, name, path, created_at, updated_at, or last_activity_at fields.
# @option options [String] :sort Return projects sorted in asc or desc order.
# @return [Array<Gitlab::ObjectifiedHash>]
def user_starred_projects(user_id, options = {})
get("/users/#{url_encode user_id}/starred_projects", query: options)
end

# Get a list of visible projects for the given user.
# @see https://docs.gitlab.com/ee/api/projects.html#list-user-projects
#
Expand Down