module Gitlab::Client::Issues

def add_time_spent_on_issue(project, id, duration)

Parameters:
  • duration (String) -- The time spent in human format. e.g: 3h30m
  • id (Integer) -- The ID of an issue.
  • project (Integer, String) -- The ID or name of a project.
def add_time_spent_on_issue(project, id, duration)
  post("/projects/#{url_encode project}/issues/#{id}/add_spent_time", body: { duration: duration })
end

def close_issue(project, id)

Returns:
  • (Gitlab::ObjectifiedHash) - Information about closed issue.

Parameters:
  • id (Integer) -- The ID of an issue.
  • project (Integer, String) -- The ID or name of a project.
def close_issue(project, id)
  put("/projects/#{url_encode project}/issues/#{id}", body: { state_event: 'close' })
end

def create_issue(project, title, options = {})

Returns:
  • (Gitlab::ObjectifiedHash) - Information about created issue.

Options Hash: (**options)
  • :labels (String) -- Comma-separated label names for an issue.
  • :milestone_id (Integer) -- The ID of a milestone to assign issue.
  • :assignee_id (Integer) -- The ID of a user to assign issue.
  • :description (String) -- The description of an issue.

Parameters:
  • options (Hash) -- A customizable set of options.
  • title (String) -- The title of an issue.
  • project (Integer, String) -- The ID or name of a project.
def create_issue(project, title, options = {})
  body = { title: title }.merge(options)
  post("/projects/#{url_encode project}/issues", body: body)
end

def delete_issue(project, id)

Returns:
  • (Gitlab::ObjectifiedHash) - Information about deleted issue.

Parameters:
  • id (Integer) -- The ID of an issue.
  • project (Integer, String) -- The ID or name of a project.
def delete_issue(project, id)
  delete("/projects/#{url_encode project}/issues/#{id}")
end

def edit_issue(project, id, options = {})

Returns:
  • (Gitlab::ObjectifiedHash) - Information about updated issue.

Options Hash: (**options)
  • :state_event (String) -- The state event of an issue ('close' or 'reopen').
  • :labels (String) -- Comma-separated label names for an issue.
  • :milestone_id (Integer) -- The ID of a milestone to assign issue.
  • :assignee_id (Integer) -- The ID of a user to assign issue.
  • :description (String) -- The description of an issue.
  • :title (String) -- The title of an issue.

Parameters:
  • options (Hash) -- A customizable set of options.
  • id (Integer) -- The ID of an issue.
  • project (Integer, String) -- The ID or name of a project.
def edit_issue(project, id, options = {})
  put("/projects/#{url_encode project}/issues/#{id}", body: options)
end

def estimate_time_of_issue(project, id, duration)

Parameters:
  • duration (String) -- The duration in human format. e.g: 3h30m
  • id (Integer) -- The ID of an issue.
  • project (Integer, String) -- The ID or name of a project.
def estimate_time_of_issue(project, id, duration)
  post("/projects/#{url_encode project}/issues/#{id}/time_estimate", body: { duration: url_encode(duration) })
end

def issue(project, id)

Returns:
  • (Gitlab::ObjectifiedHash) -

Parameters:
  • id (Integer) -- The ID of an issue.
  • project (Integer, String) -- The ID or name of a project.
def issue(project, id)
  get("/projects/#{url_encode project}/issues/#{id}")
end

def issues(project = nil, options = {})

Returns:
  • (Array) -

Options Hash: (**options)
  • :per_page (Integer) -- The number of results per page.
  • :page (Integer) -- The page number.

Parameters:
  • options (Hash) -- A customizable set of options.
  • project (Integer, String) -- The ID or name of a project.
def issues(project = nil, options = {})
  if project.to_s.empty? && project.to_i.zero?
    get('/issues', query: options)
  else
    get("/projects/#{url_encode project}/issues", query: options)
  end
end

def merge_requests_closing_issue_on_merge(project, id)

Parameters:
  • id (Integer) -- The ID of an issue.
  • project (Integer, String) -- The ID or name of a project.
def merge_requests_closing_issue_on_merge(project, id)
  get("/projects/#{url_encode project}/issues/#{id}/closed_by")
end

def move_issue(project, id, options = {})

Returns:
  • (Gitlab::ObjectifiedHash) - Information about moved issue.

Options Hash: (**options)
  • :to_project_id (String) -- The ID of the new project.

Parameters:
  • id (Integer) -- The ID of an issue.
  • project (Integer, String) -- The ID or name of a project.
def move_issue(project, id, options = {})
  post("/projects/#{url_encode project}/issues/#{id}/move", body: options)
end

def participants_on_issue(project, id)

Parameters:
  • id (Integer) -- The ID of an issue.
  • project (Integer, String) -- The ID or name of a project.
def participants_on_issue(project, id)
  get("/projects/#{url_encode project}/issues/#{id}/participants")
end

def related_merge_requests(project, id)

Parameters:
  • id (Integer) -- The ID of an issue.
  • project (Integer, String) -- The ID or name of a project.
def related_merge_requests(project, id)
  get("/projects/#{url_encode project}/issues/#{id}/related_merge_requests")
end

def reopen_issue(project, id)

Returns:
  • (Gitlab::ObjectifiedHash) - Information about reopened issue.

Parameters:
  • id (Integer) -- The ID of an issue.
  • project (Integer, String) -- The ID or name of a project.
def reopen_issue(project, id)
  put("/projects/#{url_encode project}/issues/#{id}", body: { state_event: 'reopen' })
end

def reset_time_estimate_of_issue(project, id)

Parameters:
  • id (Integer) -- The ID of an issue.
  • project (Integer, String) -- The ID or name of a project.
def reset_time_estimate_of_issue(project, id)
  post("/projects/#{url_encode project}/issues/#{id}/reset_time_estimate")
end

def reset_time_spent_on_issue(project, id)

Parameters:
  • id (Integer) -- The ID of an issue.
  • project (Integer, String) -- The ID or name of a project.
def reset_time_spent_on_issue(project, id)
  post("/projects/#{url_encode project}/issues/#{id}/reset_spent_time")
end

def subscribe_to_issue(project, id)

Returns:
  • (Gitlab::ObjectifiedHash) - Information about subscribed issue.

Parameters:
  • id (Integer) -- The ID of an issue.
  • project (Integer, String) -- The ID or name of a project.
def subscribe_to_issue(project, id)
  post("/projects/#{url_encode project}/issues/#{id}/subscribe")
end

def time_stats_for_issue(project, id)

Parameters:
  • id (Integer) -- The ID of an issue.
  • project (Integer, String) -- The ID or name of a project.
def time_stats_for_issue(project, id)
  get("/projects/#{url_encode project}/issues/#{id}/time_stats")
end

def unsubscribe_from_issue(project, id)

Returns:
  • (Gitlab::ObjectifiedHash) - Information about unsubscribed issue.

Parameters:
  • id (Integer) -- The ID of an issue.
  • project (Integer, String) -- The ID or name of a project.
def unsubscribe_from_issue(project, id)
  post("/projects/#{url_encode project}/issues/#{id}/unsubscribe")
end