2012-06-27 07:32:56 -04:00
|
|
|
module Gitlab
|
|
|
|
module Entities
|
|
|
|
class User < Grape::Entity
|
|
|
|
expose :id, :email, :name, :bio, :skype, :linkedin, :twitter,
|
|
|
|
:dark_scheme, :theme_id, :blocked, :created_at
|
|
|
|
end
|
2012-06-27 08:51:39 -04:00
|
|
|
|
2012-07-05 09:47:00 -04:00
|
|
|
class UserBasic < Grape::Entity
|
|
|
|
expose :id, :email, :name, :blocked, :created_at
|
|
|
|
end
|
|
|
|
|
2012-09-20 11:36:43 -04:00
|
|
|
class UserLogin < UserBasic
|
|
|
|
expose :private_token
|
2012-09-20 10:44:44 -04:00
|
|
|
end
|
|
|
|
|
2012-09-08 13:51:12 -04:00
|
|
|
class Hook < Grape::Entity
|
|
|
|
expose :id, :url
|
|
|
|
end
|
|
|
|
|
2012-06-27 08:51:39 -04:00
|
|
|
class Project < Grape::Entity
|
|
|
|
expose :id, :code, :name, :description, :path, :default_branch
|
2012-08-10 18:07:50 -04:00
|
|
|
expose :owner, using: Entities::UserBasic
|
|
|
|
expose :private_flag, as: :private
|
2012-06-27 08:51:39 -04:00
|
|
|
expose :issues_enabled, :merge_requests_enabled, :wall_enabled, :wiki_enabled, :created_at
|
|
|
|
end
|
|
|
|
|
2012-09-21 06:23:17 -04: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 16:49:29 -04:00
|
|
|
end
|
|
|
|
|
2012-07-06 09:08:17 -04:00
|
|
|
class RepoObject < Grape::Entity
|
2012-06-27 08:51:39 -04:00
|
|
|
expose :name, :commit
|
|
|
|
end
|
2012-06-29 09:34:08 -04:00
|
|
|
|
2012-09-21 07:34:07 -04:00
|
|
|
class RepoCommit < Grape::Entity
|
|
|
|
expose :id, :short_id, :title, :author_name, :author_email, :created_at
|
|
|
|
end
|
|
|
|
|
2012-06-29 09:34:08 -04:00
|
|
|
class ProjectSnippet < Grape::Entity
|
|
|
|
expose :id, :title, :file_name
|
2012-08-10 18:07:50 -04:00
|
|
|
expose :author, using: Entities::UserBasic
|
2012-06-29 09:34:08 -04:00
|
|
|
expose :expires_at, :updated_at, :created_at
|
|
|
|
end
|
2012-07-24 08:19:51 -04:00
|
|
|
|
|
|
|
class Milestone < Grape::Entity
|
2012-09-20 08:38:34 -04:00
|
|
|
expose :id
|
|
|
|
expose (:project_id) {|milestone| milestone.project.id}
|
|
|
|
expose :title, :description, :due_date, :closed, :updated_at, :created_at
|
2012-07-24 08:19:51 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
class Issue < Grape::Entity
|
2012-07-25 07:22:21 -04:00
|
|
|
expose :id
|
|
|
|
expose (:project_id) {|issue| issue.project.id}
|
|
|
|
expose :title, :description
|
2012-08-10 18:07:50 -04:00
|
|
|
expose :label_list, as: :labels
|
|
|
|
expose :milestone, using: Entities::Milestone
|
|
|
|
expose :assignee, :author, using: Entities::UserBasic
|
2012-07-24 08:19:51 -04:00
|
|
|
expose :closed, :updated_at, :created_at
|
|
|
|
end
|
2012-09-16 10:52:06 -04:00
|
|
|
|
2012-09-21 07:49:28 -04:00
|
|
|
class SSHKey < Grape::Entity
|
|
|
|
expose :id, :title, :key
|
2012-09-16 10:52:06 -04:00
|
|
|
end
|
2012-10-21 07:00:27 -04:00
|
|
|
|
|
|
|
class MergeRequest < Grape::Entity
|
|
|
|
expose :id, :target_branch, :source_branch, :project_id,
|
|
|
|
:title, :closed, :merged
|
|
|
|
expose :author, :assignee, using: Entities::UserBasic
|
|
|
|
end
|
2012-10-21 12:48:56 -04:00
|
|
|
|
|
|
|
class Note < Grape::Entity
|
|
|
|
expose :author, using: Entities::UserBasic
|
|
|
|
expose :note
|
|
|
|
end
|
2012-06-27 07:32:56 -04:00
|
|
|
end
|
|
|
|
end
|