diff --git a/lib/gitlab/client/projects.rb b/lib/gitlab/client/projects.rb index b0455df59..0109b4135 100644 --- a/lib/gitlab/client/projects.rb +++ b/lib/gitlab/client/projects.rb @@ -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] + 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 #