-
Notifications
You must be signed in to change notification settings - Fork 664
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Jira: Add functionality to get comments on an issue #1064
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
2fbf683
Jira: Add functionality to get comments on an issue
martynbristow 031b93a
Update quotes
martynbristow 687a28d
PR Comments
martynbristow 17a85c6
Jira: Add functionality to get comments on an issue
martynbristow 66e0ad3
Jira: Add functionality to get comments on an issue
martynbristow File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
""" Example: Get Comments on a Jira Issue | ||
""" | ||
# coding=utf-8 | ||
from atlassian import Jira | ||
|
||
|
||
def main(): | ||
jira = Jira(url="https://atlassian-python.atlassian.net/", username="martyn.bristow@gmail.com", password="...") | ||
|
||
print("\n*Get Comments on INT-1*") | ||
comments = jira.issue_get_comments("INT-1") | ||
print(comments) | ||
|
||
print("\n*Get a single comment on INT-1*") | ||
comments = jira.issue_get_comment(10000, 10001) | ||
print(comments) | ||
|
||
print("\n*Get a set of comments*") | ||
comments = jira.issues_get_comments_by_id(10000, 10002) | ||
print(comments) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
responses["fields=*all"] = { | ||
"maxResults": 1048576, | ||
"startAt": 0, | ||
"total": 2, | ||
"isLast": true, | ||
"values": [ | ||
{ | ||
"self": "https://atlassian-python.atlassian.net/rest/api/2/issue/10000/comment/10000", | ||
"id": "10000", | ||
"author": { | ||
"self": "https://atlassian-python.atlassian.net/rest/api/2/user?accountId=557058%3Adc675182-d776-46f5-90fb-fe5637b71397", | ||
"accountId": "557058:dc675182-d776-46f5-90fb-fe5637b71397", | ||
"emailAddress": "martyn.bristow@gmail.com", | ||
"avatarUrls": { | ||
"48x48": "https://secure.gravatar.com/avatar/6f1cc3b97033de549f9d156d0eea4a34?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FMB-4.png", | ||
"24x24": "https://secure.gravatar.com/avatar/6f1cc3b97033de549f9d156d0eea4a34?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FMB-4.png", | ||
"16x16": "https://secure.gravatar.com/avatar/6f1cc3b97033de549f9d156d0eea4a34?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FMB-4.png", | ||
"32x32": "https://secure.gravatar.com/avatar/6f1cc3b97033de549f9d156d0eea4a34?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FMB-4.png", | ||
}, | ||
"displayName": "Martyn Bristow", | ||
"active": true, | ||
"timeZone": "Europe/London", | ||
"accountType": "atlassian", | ||
}, | ||
"body": "Some Text comment", | ||
"updateAuthor": { | ||
"self": "https://atlassian-python.atlassian.net/rest/api/2/user?accountId=557058%3Adc675182-d776-46f5-90fb-fe5637b71397", | ||
"accountId": "557058:dc675182-d776-46f5-90fb-fe5637b71397", | ||
"emailAddress": "martyn.bristow@gmail.com", | ||
"avatarUrls": { | ||
"48x48": "https://secure.gravatar.com/avatar/6f1cc3b97033de549f9d156d0eea4a34?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FMB-4.png", | ||
"24x24": "https://secure.gravatar.com/avatar/6f1cc3b97033de549f9d156d0eea4a34?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FMB-4.png", | ||
"16x16": "https://secure.gravatar.com/avatar/6f1cc3b97033de549f9d156d0eea4a34?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FMB-4.png", | ||
"32x32": "https://secure.gravatar.com/avatar/6f1cc3b97033de549f9d156d0eea4a34?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FMB-4.png", | ||
}, | ||
"displayName": "Martyn Bristow", | ||
"active": true, | ||
"timeZone": "Europe/London", | ||
"accountType": "atlassian", | ||
}, | ||
"created": "2022-10-25T20:21:33.277+0100", | ||
"updated": "2022-10-25T20:21:33.277+0100", | ||
"jsdPublic": true, | ||
}, | ||
{ | ||
"self": "https://atlassian-python.atlassian.net/rest/api/2/issue/10000/comment/10001", | ||
"id": "10001", | ||
"author": { | ||
"self": "https://atlassian-python.atlassian.net/rest/api/2/user?accountId=557058%3Adc675182-d776-46f5-90fb-fe5637b71397", | ||
"accountId": "557058:dc675182-d776-46f5-90fb-fe5637b71397", | ||
"emailAddress": "martyn.bristow@gmail.com", | ||
"avatarUrls": { | ||
"48x48": "https://secure.gravatar.com/avatar/6f1cc3b97033de549f9d156d0eea4a34?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FMB-4.png", | ||
"24x24": "https://secure.gravatar.com/avatar/6f1cc3b97033de549f9d156d0eea4a34?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FMB-4.png", | ||
"16x16": "https://secure.gravatar.com/avatar/6f1cc3b97033de549f9d156d0eea4a34?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FMB-4.png", | ||
"32x32": "https://secure.gravatar.com/avatar/6f1cc3b97033de549f9d156d0eea4a34?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FMB-4.png", | ||
}, | ||
"displayName": "Martyn Bristow", | ||
"active": true, | ||
"timeZone": "Europe/London", | ||
"accountType": "atlassian", | ||
}, | ||
"body": "Second Comment", | ||
"updateAuthor": { | ||
"self": "https://atlassian-python.atlassian.net/rest/api/2/user?accountId=557058%3Adc675182-d776-46f5-90fb-fe5637b71397", | ||
"accountId": "557058:dc675182-d776-46f5-90fb-fe5637b71397", | ||
"emailAddress": "martyn.bristow@gmail.com", | ||
"avatarUrls": { | ||
"48x48": "https://secure.gravatar.com/avatar/6f1cc3b97033de549f9d156d0eea4a34?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FMB-4.png", | ||
"24x24": "https://secure.gravatar.com/avatar/6f1cc3b97033de549f9d156d0eea4a34?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FMB-4.png", | ||
"16x16": "https://secure.gravatar.com/avatar/6f1cc3b97033de549f9d156d0eea4a34?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FMB-4.png", | ||
"32x32": "https://secure.gravatar.com/avatar/6f1cc3b97033de549f9d156d0eea4a34?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FMB-4.png", | ||
}, | ||
"displayName": "Martyn Bristow", | ||
"active": true, | ||
"timeZone": "Europe/London", | ||
"accountType": "atlassian", | ||
}, | ||
"created": "2022-10-25T20:21:40.840+0100", | ||
"updated": "2022-10-25T20:21:40.840+0100", | ||
"jsdPublic": true, | ||
}, | ||
], | ||
} |
38 changes: 38 additions & 0 deletions
38
tests/responses/jira/rest/api/2/issue/FOO-123/comment/10000/GET
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
responses[None] = { | ||
"self": "https://atlassian-python.atlassian.net/rest/api/2/issue/10000/comment/10000", | ||
"id": "10000", | ||
"author": { | ||
"self": "https://atlassian-python.atlassian.net/rest/api/2/user?accountId=557058%3Adc675182-d776-46f5-90fb-fe5637b71397", | ||
"accountId": "557058:dc675182-d776-46f5-90fb-fe5637b71397", | ||
"emailAddress": "martyn.bristow@gmail.com", | ||
"avatarUrls": { | ||
"48x48": "https://secure.gravatar.com/avatar/6f1cc3b97033de549f9d156d0eea4a34?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FMB-4.png", | ||
"24x24": "https://secure.gravatar.com/avatar/6f1cc3b97033de549f9d156d0eea4a34?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FMB-4.png", | ||
"16x16": "https://secure.gravatar.com/avatar/6f1cc3b97033de549f9d156d0eea4a34?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FMB-4.png", | ||
"32x32": "https://secure.gravatar.com/avatar/6f1cc3b97033de549f9d156d0eea4a34?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FMB-4.png", | ||
}, | ||
"displayName": "Martyn Bristow", | ||
"active": true, | ||
"timeZone": "Europe/London", | ||
"accountType": "atlassian", | ||
}, | ||
"body": "Some Text comment", | ||
"updateAuthor": { | ||
"self": "https://atlassian-python.atlassian.net/rest/api/2/user?accountId=557058%3Adc675182-d776-46f5-90fb-fe5637b71397", | ||
"accountId": "557058:dc675182-d776-46f5-90fb-fe5637b71397", | ||
"emailAddress": "martyn.bristow@gmail.com", | ||
"avatarUrls": { | ||
"48x48": "https://secure.gravatar.com/avatar/6f1cc3b97033de549f9d156d0eea4a34?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FMB-4.png", | ||
"24x24": "https://secure.gravatar.com/avatar/6f1cc3b97033de549f9d156d0eea4a34?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FMB-4.png", | ||
"16x16": "https://secure.gravatar.com/avatar/6f1cc3b97033de549f9d156d0eea4a34?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FMB-4.png", | ||
"32x32": "https://secure.gravatar.com/avatar/6f1cc3b97033de549f9d156d0eea4a34?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FMB-4.png", | ||
}, | ||
"displayName": "Martyn Bristow", | ||
"active": true, | ||
"timeZone": "Europe/London", | ||
"accountType": "atlassian", | ||
}, | ||
"created": "2022-10-25T20:21:33.277+0100", | ||
"updated": "2022-10-25T20:21:33.277+0100", | ||
"jsdPublic": true, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
responses[None] = { | ||
"startAt": 0, | ||
"maxResults": 1048576, | ||
"total": 2, | ||
"comments": [ | ||
{ | ||
"self": "https://atlassian-python.atlassian.net/rest/api/2/issue/10000/comment/10000", | ||
"id": "10000", | ||
"author": { | ||
"self": "https://atlassian-python.atlassian.net/rest/api/2/user?accountId=557058%3Adc675182-d776-46f5-90fb-fe5637b71397", | ||
"accountId": "557058:dc675182-d776-46f5-90fb-fe5637b71397", | ||
"emailAddress": "martyn.bristow@gmail.com", | ||
"avatarUrls": { | ||
"48x48": "https://secure.gravatar.com/avatar/6f1cc3b97033de549f9d156d0eea4a34?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FMB-4.png", | ||
"24x24": "https://secure.gravatar.com/avatar/6f1cc3b97033de549f9d156d0eea4a34?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FMB-4.png", | ||
"16x16": "https://secure.gravatar.com/avatar/6f1cc3b97033de549f9d156d0eea4a34?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FMB-4.png", | ||
"32x32": "https://secure.gravatar.com/avatar/6f1cc3b97033de549f9d156d0eea4a34?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FMB-4.png", | ||
}, | ||
"displayName": "Martyn Bristow", | ||
"active": true, | ||
"timeZone": "Europe/London", | ||
"accountType": "atlassian", | ||
}, | ||
"body": "Some Text comment", | ||
"updateAuthor": { | ||
"self": "https://atlassian-python.atlassian.net/rest/api/2/user?accountId=557058%3Adc675182-d776-46f5-90fb-fe5637b71397", | ||
"accountId": "557058:dc675182-d776-46f5-90fb-fe5637b71397", | ||
"emailAddress": "martyn.bristow@gmail.com", | ||
"avatarUrls": { | ||
"48x48": "https://secure.gravatar.com/avatar/6f1cc3b97033de549f9d156d0eea4a34?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FMB-4.png", | ||
"24x24": "https://secure.gravatar.com/avatar/6f1cc3b97033de549f9d156d0eea4a34?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FMB-4.png", | ||
"16x16": "https://secure.gravatar.com/avatar/6f1cc3b97033de549f9d156d0eea4a34?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FMB-4.png", | ||
"32x32": "https://secure.gravatar.com/avatar/6f1cc3b97033de549f9d156d0eea4a34?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FMB-4.png", | ||
}, | ||
"displayName": "Martyn Bristow", | ||
"active": true, | ||
"timeZone": "Europe/London", | ||
"accountType": "atlassian", | ||
}, | ||
"created": "2022-10-25T20:21:33.277+0100", | ||
"updated": "2022-10-25T20:21:33.277+0100", | ||
"jsdPublic": true, | ||
}, | ||
{ | ||
"self": "https://atlassian-python.atlassian.net/rest/api/2/issue/10000/comment/10001", | ||
"id": "10001", | ||
"author": { | ||
"self": "https://atlassian-python.atlassian.net/rest/api/2/user?accountId=557058%3Adc675182-d776-46f5-90fb-fe5637b71397", | ||
"accountId": "557058:dc675182-d776-46f5-90fb-fe5637b71397", | ||
"emailAddress": "martyn.bristow@gmail.com", | ||
"avatarUrls": { | ||
"48x48": "https://secure.gravatar.com/avatar/6f1cc3b97033de549f9d156d0eea4a34?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FMB-4.png", | ||
"24x24": "https://secure.gravatar.com/avatar/6f1cc3b97033de549f9d156d0eea4a34?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FMB-4.png", | ||
"16x16": "https://secure.gravatar.com/avatar/6f1cc3b97033de549f9d156d0eea4a34?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FMB-4.png", | ||
"32x32": "https://secure.gravatar.com/avatar/6f1cc3b97033de549f9d156d0eea4a34?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FMB-4.png", | ||
}, | ||
"displayName": "Martyn Bristow", | ||
"active": true, | ||
"timeZone": "Europe/London", | ||
"accountType": "atlassian", | ||
}, | ||
"body": "Second Comment", | ||
"updateAuthor": { | ||
"self": "https://atlassian-python.atlassian.net/rest/api/2/user?accountId=557058%3Adc675182-d776-46f5-90fb-fe5637b71397", | ||
"accountId": "557058:dc675182-d776-46f5-90fb-fe5637b71397", | ||
"emailAddress": "martyn.bristow@gmail.com", | ||
"avatarUrls": { | ||
"48x48": "https://secure.gravatar.com/avatar/6f1cc3b97033de549f9d156d0eea4a34?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FMB-4.png", | ||
"24x24": "https://secure.gravatar.com/avatar/6f1cc3b97033de549f9d156d0eea4a34?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FMB-4.png", | ||
"16x16": "https://secure.gravatar.com/avatar/6f1cc3b97033de549f9d156d0eea4a34?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FMB-4.png", | ||
"32x32": "https://secure.gravatar.com/avatar/6f1cc3b97033de549f9d156d0eea4a34?d=https%3A%2F%2Favatar-management--avatars.us-west-2.prod.public.atl-paas.net%2Finitials%2FMB-4.png", | ||
}, | ||
"displayName": "Martyn Bristow", | ||
"active": true, | ||
"timeZone": "Europe/London", | ||
"accountType": "atlassian", | ||
}, | ||
"created": "2022-10-25T20:21:40.840+0100", | ||
"updated": "2022-10-25T20:21:40.840+0100", | ||
"jsdPublic": true, | ||
}, | ||
], | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just a suggestion for the naming of function,
keeping in line with the single comment function naming convention,
could we keep multiple
comments
for the singleissue
named as,issue_get_comments_selective
rather thanissues_get_comments_by_id
to help us understand that it is multiple selected comments for single issue.
Or some other better name? because i believe the filtering would always be based on the comment_id so keeping by_id mite be redundant here.
because it would always be comments drawn for the single issue and not multiple one if i understand correctly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I'm happy to change it to this. My only reason for choosing:
issues_get_comments_by_id
was to be consistent with the Atlassian JIRA API docs: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issue-comments/#api-rest-api-3-comment-list-postissues_get_comments_by_ids is still a bit weak
, so I'll consider selective unless I have an ideaI also chose:
issues_get_comments
rather thanget_issue_comments
to match some existing codeThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that sounds fine then, looks good to me for merge, thanks!