Module: BacklogKit::Client::Issue

Included in:
BacklogKit::Client
Defined in:
lib/backlog_kit/client/issue.rb

Overview

Methods for the Issue API

Instance Method Summary collapse

Instance Method Details

#add_comment(issue_id_or_key, content, params = {}) ⇒ BacklogKit::Response

Add a comment to an issue

Parameters:

  • issue_id_or_key (Integer, String)

    Issue id or Issue key

  • content (String)

    Content of the comment

  • params (Hash) (defaults to: {})

    Request parameters

Returns:



88
89
90
91
# File 'lib/backlog_kit/client/issue.rb', line 88

def add_comment(issue_id_or_key, content, params = {})
  params[:content] = content
  post("issues/#{issue_id_or_key}/comments", params)
end

#add_comment_notification(issue_id_or_key, comment_id, notified_user_ids = []) ⇒ BacklogKit::Response

Add notifications to an comment

Parameters:

  • issue_id_or_key (Integer, String)

    Issue id or Issue key

  • comment_id (Integer, String)

    Comment id

  • notified_user_ids (Array) (defaults to: [])

    List of notified user ids

Returns:



127
128
129
# File 'lib/backlog_kit/client/issue.rb', line 127

def add_comment_notification(issue_id_or_key, comment_id, notified_user_ids = [])
  post("issues/#{issue_id_or_key}/comments/#{comment_id}/notifications", notified_user_id: notified_user_ids)
end

#create_issue(summary, params = {}) ⇒ BacklogKit::Response

Create a new issue

Parameters:

  • summary (String)

    Summary of the issue

  • params (Hash) (defaults to: {})

    Request parameters

Returns:



34
35
36
37
# File 'lib/backlog_kit/client/issue.rb', line 34

def create_issue(summary, params = {})
  params[:summary] = summary
  post('issues', params)
end

#delete_comment(issue_id_or_key, comment_id) ⇒ BacklogKit::Response

Delete a comment in issue

Parameters:

  • issue_id_or_key (Integer, String)

    Issue id or Issue key

  • comment_id (Integer, String)

    Comment id

Returns:



108
109
110
# File 'lib/backlog_kit/client/issue.rb', line 108

def delete_comment(issue_id_or_key, comment_id)
  delete("issues/#{issue_id_or_key}/comments/#{comment_id}")
end

#delete_issue(issue_id_or_key) ⇒ BacklogKit::Response

Delete an issue

Parameters:

  • issue_id_or_key (Integer, String)

    Issue id or Issue key

Returns:



52
53
54
# File 'lib/backlog_kit/client/issue.rb', line 52

def delete_issue(issue_id_or_key)
  delete("issues/#{issue_id_or_key}")
end

#download_issue_attachment(issue_id_or_key, attachment_id) ⇒ BacklogKit::Response

Download an attachment file on issue

Parameters:

  • issue_id_or_key (Integer, String)

    Issue id or Issue key

  • attachment_id (Integer, String)

    Attachment file id

Returns:



144
145
146
# File 'lib/backlog_kit/client/issue.rb', line 144

def download_issue_attachment(issue_id_or_key, attachment_id)
  get("issues/#{issue_id_or_key}/attachments/#{attachment_id}")
end

#get_comment(issue_id_or_key, comment_id) ⇒ BacklogKit::Response

Get a comment in issue

Parameters:

  • issue_id_or_key (Integer, String)

    Issue id or Issue key

  • comment_id (Integer, String)

    Comment id

Returns:



78
79
80
# File 'lib/backlog_kit/client/issue.rb', line 78

def get_comment(issue_id_or_key, comment_id)
  get("issues/#{issue_id_or_key}/comments/#{comment_id}")
end

#get_comment_count(issue_id_or_key) ⇒ BacklogKit::Response

Get number of comments in issue

Parameters:

  • issue_id_or_key (Integer, String)

    Issue id or Issue key

Returns:



69
70
71
# File 'lib/backlog_kit/client/issue.rb', line 69

def get_comment_count(issue_id_or_key)
  get("issues/#{issue_id_or_key}/comments/count")
end

#get_comment_notifications(issue_id_or_key, comment_id) ⇒ BacklogKit::Response

Get list of comment notifications

Parameters:

  • issue_id_or_key (Integer, String)

    Issue id or Issue key

  • comment_id (Integer, String)

    Comment id

Returns:



117
118
119
# File 'lib/backlog_kit/client/issue.rb', line 117

def get_comment_notifications(issue_id_or_key, comment_id)
  get("issues/#{issue_id_or_key}/comments/#{comment_id}/notifications")
end

#get_comments(issue_id_or_key, params = {}) ⇒ BacklogKit::Response

Get list of comments in issue

Parameters:

  • issue_id_or_key (Integer, String)

    Issue id or Issue key

  • params (Hash) (defaults to: {})

    Request parameters

Returns:



61
62
63
# File 'lib/backlog_kit/client/issue.rb', line 61

def get_comments(issue_id_or_key, params = {})
  get("issues/#{issue_id_or_key}/comments", params)
end

#get_issue(issue_id_or_key) ⇒ BacklogKit::Response

Get an issue

Parameters:

  • issue_id_or_key (Integer, String)

    Issue id or Issue key

Returns:



25
26
27
# File 'lib/backlog_kit/client/issue.rb', line 25

def get_issue(issue_id_or_key)
  get("issues/#{issue_id_or_key}")
end

#get_issue_attachments(issue_id_or_key) ⇒ BacklogKit::Response

Get list of attachment files on issue

Parameters:

  • issue_id_or_key (Integer, String)

    Issue id or Issue key

Returns:



135
136
137
# File 'lib/backlog_kit/client/issue.rb', line 135

def get_issue_attachments(issue_id_or_key)
  get("issues/#{issue_id_or_key}/attachments")
end

#get_issue_count(params = {}) ⇒ BacklogKit::Response

Get number of issues

Parameters:

  • params (Hash) (defaults to: {})

    Request parameters

Returns:



17
18
19
# File 'lib/backlog_kit/client/issue.rb', line 17

def get_issue_count(params = {})
  get('issues/count', params)
end

#get_issue_shared_files(issue_id_or_key) ⇒ BacklogKit::Response

Get list of shared files on issue

Parameters:

  • issue_id_or_key (Integer, String)

    Issue id or Issue key

Returns:



161
162
163
# File 'lib/backlog_kit/client/issue.rb', line 161

def get_issue_shared_files(issue_id_or_key)
  get("issues/#{issue_id_or_key}/sharedFiles")
end

#get_issues(params = {}) ⇒ BacklogKit::Response

Get list of issues

Parameters:

  • params (Hash) (defaults to: {})

    Request parameters

Returns:



9
10
11
# File 'lib/backlog_kit/client/issue.rb', line 9

def get_issues(params = {})
  get('issues', params)
end

Link shared files to an issue

Parameters:

  • issue_id_or_key (Integer, String)

    Issue id or Issue key

  • file_ids (Array) (defaults to: [])

    List of file ids

Returns:



170
171
172
# File 'lib/backlog_kit/client/issue.rb', line 170

def link_issue_shared_files(issue_id_or_key, file_ids = [])
  post("issues/#{issue_id_or_key}/sharedFiles", file_id: file_ids)
end

#remove_issue_attachment(issue_id_or_key, attachment_id) ⇒ BacklogKit::Response

Remove an attachment file from issue

Parameters:

  • issue_id_or_key (Integer, String)

    Issue id or Issue key

  • attachment_id (Integer, String)

    Attachment file id

Returns:



153
154
155
# File 'lib/backlog_kit/client/issue.rb', line 153

def remove_issue_attachment(issue_id_or_key, attachment_id)
  delete("issues/#{issue_id_or_key}/attachments/#{attachment_id}")
end

Unlink a shared file on issue

Parameters:

  • issue_id_or_key (Integer, String)

    Issue id or Issue key

  • file_id (Integer, String)

    Shared file id

Returns:



179
180
181
# File 'lib/backlog_kit/client/issue.rb', line 179

def unlink_issue_shared_file(issue_id_or_key, file_id)
  delete("issues/#{issue_id_or_key}/sharedFiles/#{file_id}")
end

#update_comment(issue_id_or_key, comment_id, content) ⇒ BacklogKit::Response

Update a comment in issue

Parameters:

  • issue_id_or_key (Integer, String)

    Issue id or Issue key

  • comment_id (Integer, String)

    Comment id

  • content (String)

    Content of the comment

Returns:



99
100
101
# File 'lib/backlog_kit/client/issue.rb', line 99

def update_comment(issue_id_or_key, comment_id, content)
  patch("issues/#{issue_id_or_key}/comments/#{comment_id}", content: content)
end

#update_issue(issue_id_or_key, params = {}) ⇒ BacklogKit::Response

Update an issue

Parameters:

  • issue_id_or_key (Integer, String)

    Issue id or Issue key

  • params (Hash) (defaults to: {})

    Request parameters

Returns:



44
45
46
# File 'lib/backlog_kit/client/issue.rb', line 44

def update_issue(issue_id_or_key, params = {})
  patch("issues/#{issue_id_or_key}", params)
end