2012-06-27 13:32:56 +02:00
|
|
|
module Gitlab
|
|
|
|
module Entities
|
|
|
|
class User < Grape::Entity
|
2012-12-10 23:46:31 +01:00
|
|
|
expose :id, :username, :email, :name, :bio, :skype, :linkedin, :twitter,
|
2013-03-04 15:52:30 +01:00
|
|
|
:dark_scheme, :theme_id, :state, :created_at, :extern_uid, :provider
|
2012-06-27 13:32:56 +02:00
|
|
|
end
|
2012-06-27 14:51:39 +02:00
|
|
|
|
2013-03-11 13:35:00 +01:00
|
|
|
class UserSafe < Grape::Entity
|
|
|
|
expose :name
|
|
|
|
end
|
|
|
|
|
2012-07-05 15:47:00 +02:00
|
|
|
class UserBasic < Grape::Entity
|
2013-03-04 15:52:30 +01:00
|
|
|
expose :id, :username, :email, :name, :state, :created_at
|
2012-07-05 15:47:00 +02:00
|
|
|
end
|
|
|
|
|
2012-09-20 17:36:43 +02:00
|
|
|
class UserLogin < UserBasic
|
|
|
|
expose :private_token
|
2012-09-20 16:44:44 +02:00
|
|
|
end
|
|
|
|
|
2012-09-08 19:51:12 +02:00
|
|
|
class Hook < Grape::Entity
|
2012-11-29 23:59:56 +01:00
|
|
|
expose :id, :url, :created_at
|
2012-09-08 19:51:12 +02:00
|
|
|
end
|
|
|
|
|
2012-06-27 14:51:39 +02:00
|
|
|
class Project < Grape::Entity
|
2012-12-22 20:06:18 +01:00
|
|
|
expose :id, :name, :description, :default_branch
|
2012-08-11 00:07:50 +02:00
|
|
|
expose :owner, using: Entities::UserBasic
|
2013-02-19 10:45:49 +01:00
|
|
|
expose :public
|
2013-01-31 08:11:35 +01:00
|
|
|
expose :path, :path_with_namespace
|
2012-06-27 14:51:39 +02:00
|
|
|
expose :issues_enabled, :merge_requests_enabled, :wall_enabled, :wiki_enabled, :created_at
|
2013-01-02 21:31:20 +01:00
|
|
|
expose :namespace
|
2012-06-27 14:51:39 +02:00
|
|
|
end
|
|
|
|
|
2012-09-21 12:23:17 +02:00
|
|
|
class ProjectMember < UserBasic
|
|
|
|
expose :project_access, :as => :access_level do |user, options|
|
|
|
|
options[:project].users_projects.find_by_user_id(user.id).project_access
|
|
|
|
end
|
2012-09-06 22:49:29 +02:00
|
|
|
end
|
|
|
|
|
2013-01-08 22:05:00 +01:00
|
|
|
class Group < Grape::Entity
|
2013-02-01 15:00:12 +01:00
|
|
|
expose :id, :name, :path, :owner_id
|
2013-01-08 22:05:00 +01:00
|
|
|
end
|
2013-02-18 10:10:58 +01:00
|
|
|
|
2013-02-03 19:38:33 +01:00
|
|
|
class GroupDetail < Group
|
2013-01-08 22:05:00 +01:00
|
|
|
expose :projects, using: Entities::Project
|
|
|
|
end
|
|
|
|
|
2012-07-06 15:08:17 +02:00
|
|
|
class RepoObject < Grape::Entity
|
2012-06-27 14:51:39 +02:00
|
|
|
expose :name, :commit
|
2013-01-28 18:22:44 +01:00
|
|
|
expose :protected do |repo, options|
|
|
|
|
if options[:project]
|
|
|
|
options[:project].protected_branch? repo.name
|
|
|
|
end
|
|
|
|
end
|
2012-06-27 14:51:39 +02:00
|
|
|
end
|
2012-06-29 15:34:08 +02:00
|
|
|
|
2012-09-21 13:34:07 +02:00
|
|
|
class RepoCommit < Grape::Entity
|
|
|
|
expose :id, :short_id, :title, :author_name, :author_email, :created_at
|
|
|
|
end
|
|
|
|
|
2012-06-29 15:34:08 +02:00
|
|
|
class ProjectSnippet < Grape::Entity
|
|
|
|
expose :id, :title, :file_name
|
2012-08-11 00:07:50 +02:00
|
|
|
expose :author, using: Entities::UserBasic
|
2012-06-29 15:34:08 +02:00
|
|
|
expose :expires_at, :updated_at, :created_at
|
|
|
|
end
|
2012-07-24 14:19:51 +02:00
|
|
|
|
|
|
|
class Milestone < Grape::Entity
|
2012-09-20 14:38:34 +02:00
|
|
|
expose :id
|
|
|
|
expose (:project_id) {|milestone| milestone.project.id}
|
2013-02-18 10:10:58 +01:00
|
|
|
expose :title, :description, :due_date, :state, :updated_at, :created_at
|
2012-07-24 14:19:51 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
class Issue < Grape::Entity
|
2012-07-25 13:22:21 +02:00
|
|
|
expose :id
|
|
|
|
expose (:project_id) {|issue| issue.project.id}
|
|
|
|
expose :title, :description
|
2012-08-11 00:07:50 +02:00
|
|
|
expose :label_list, as: :labels
|
|
|
|
expose :milestone, using: Entities::Milestone
|
|
|
|
expose :assignee, :author, using: Entities::UserBasic
|
2013-02-18 10:10:58 +01:00
|
|
|
expose :state, :updated_at, :created_at
|
2012-07-24 14:19:51 +02:00
|
|
|
end
|
2012-09-16 16:52:06 +02:00
|
|
|
|
2012-09-21 13:49:28 +02:00
|
|
|
class SSHKey < Grape::Entity
|
2012-11-29 23:59:56 +01:00
|
|
|
expose :id, :title, :key, :created_at
|
2012-09-16 16:52:06 +02:00
|
|
|
end
|
2012-10-21 13:00:27 +02:00
|
|
|
|
|
|
|
class MergeRequest < Grape::Entity
|
2013-02-18 10:07:49 +01:00
|
|
|
expose :id, :target_branch, :source_branch, :project_id, :title, :state
|
2012-10-21 13:00:27 +02:00
|
|
|
expose :author, :assignee, using: Entities::UserBasic
|
|
|
|
end
|
2012-10-21 18:48:56 +02:00
|
|
|
|
|
|
|
class Note < Grape::Entity
|
2012-11-27 20:43:39 +01:00
|
|
|
expose :id
|
|
|
|
expose :note, as: :body
|
2012-10-21 18:48:56 +02:00
|
|
|
expose :author, using: Entities::UserBasic
|
2012-11-29 23:41:24 +01:00
|
|
|
expose :created_at
|
2012-10-21 18:48:56 +02:00
|
|
|
end
|
2012-11-29 21:10:07 +01:00
|
|
|
|
|
|
|
class MRNote < Grape::Entity
|
|
|
|
expose :note
|
|
|
|
expose :author, using: Entities::UserBasic
|
|
|
|
end
|
2012-06-27 13:32:56 +02:00
|
|
|
end
|
|
|
|
end
|