update all usage of user.name to user.accountId for privacy migration:

https://developer.atlassian.com/cloud/jira/platform/deprecation-notice-user-privacy-api-migration-guide/
This commit is contained in:
Cory Bennett
2020-02-23 23:59:39 -08:00
parent 57e1c7426e
commit a26683e01d
24 changed files with 557 additions and 206 deletions
+33 -33
View File
@@ -35,8 +35,8 @@ status: To Do
summary: summary
project: BASIC
issuetype: Bug
assignee: gojira
reporter: gojira
assignee: GoJira
reporter: GoJira
priority: Medium
votes: 0
description: |
@@ -69,7 +69,7 @@ DIFF <<EOF
+------------+---------+------+----------+--------+----------+----------+----------+
| Issue | Summary | Type | Priority | Status | Age | Reporter | Assignee |
+------------+---------+------+----------+--------+----------+----------+----------+
| $issue | summary | Bug | Medium | To Do | a minute | gojira | gojira |
| $issue | summary | Bug | Medium | To Do | a minute | GoJira | GoJira |
+------------+---------+------+----------+--------+----------+----------+----------+
EOF
@@ -97,17 +97,17 @@ status: To Do
summary: summary
project: BASIC
issuetype: Bug
assignee: gojira
reporter: gojira
assignee: GoJira
reporter: GoJira
priority: High
votes: 0
description: |
description
comments:
- | # gojira, a minute ago
- | # GoJira, a minute ago
edit comment
- | # gojira, a minute ago
- | # GoJira, a minute ago
bulk edit comment
EOF
@@ -174,8 +174,8 @@ status: To Do
summary: summary
project: BASIC
issuetype: Bug
assignee: gojira
reporter: gojira
assignee: GoJira
reporter: GoJira
blockers:
depends: $dup[Done]
priority: Medium
@@ -221,8 +221,8 @@ status: To Do
summary: summary
project: BASIC
issuetype: Bug
assignee: gojira
reporter: gojira
assignee: GoJira
reporter: GoJira
blockers: $blocker[To Do]
depends: $dup[Done]
priority: Medium
@@ -267,8 +267,8 @@ status: To Do
summary: summary
project: BASIC
issuetype: Bug
assignee: gojira
reporter: gojira
assignee: GoJira
reporter: GoJira
blockers: $blocker[To Do]
depends: $dup[Done]
priority: Medium
@@ -294,8 +294,8 @@ status: To Do
summary: summary
project: BASIC
issuetype: Bug
assignee: gojira
reporter: gojira
assignee: GoJira
reporter: GoJira
blockers: $blocker[To Do]
depends: $dup[Done]
priority: Medium
@@ -314,10 +314,10 @@ OK $issue $ENDPOINT/browse/$issue
EOF
# FIXME we probably need a watchers command to wrap this?
RUNS sh -c "$jira req /rest/api/2/issue/$issue/watchers | jq -r .watchers[].name | sort"
RUNS sh -c "$jira req /rest/api/2/issue/$issue/watchers | jq -r .watchers[].displayName | sort"
DIFF <<EOF
gojira
mothra
GoJira
Mothra
EOF
###############################################################################
@@ -386,8 +386,8 @@ status: To Do
summary: summary
project: BASIC
issuetype: Bug
assignee: gojira
reporter: gojira
assignee: GoJira
reporter: GoJira
blockers: $blocker[Done]
depends: $dup[Done]
priority: Medium
@@ -413,8 +413,8 @@ status: To Do
summary: summary
project: BASIC
issuetype: Bug
assignee: gojira
reporter: gojira
assignee: GoJira
reporter: GoJira
blockers: $blocker[Done]
depends: $dup[Done]
priority: Medium
@@ -423,7 +423,7 @@ description: |
description
comments:
- | # mothra, a minute ago
- | # Mothra, a minute ago
Yo, Comment
EOF
@@ -445,8 +445,8 @@ status: Done
summary: blocks
project: BASIC
issuetype: Bug
assignee: gojira
reporter: gojira
assignee: GoJira
reporter: GoJira
blockers:
depends: $issue[To Do]
priority: Medium
@@ -473,8 +473,8 @@ status: Done
summary: blocks
project: BASIC
issuetype: Bug
assignee: gojira
reporter: gojira
assignee: GoJira
reporter: GoJira
blockers:
depends: $issue[To Do]
priority: Medium
@@ -501,8 +501,8 @@ status: Done
summary: blocks
project: BASIC
issuetype: Bug
assignee: gojira
reporter: gojira
assignee: GoJira
reporter: GoJira
blockers:
depends: $issue[To Do]
priority: Medium
@@ -529,8 +529,8 @@ status: Done
summary: blocks
project: BASIC
issuetype: Bug
assignee: mothra
reporter: gojira
assignee: Mothra
reporter: GoJira
blockers:
depends: $issue[To Do]
priority: Medium
@@ -557,8 +557,8 @@ status: Done
summary: blocks
project: BASIC
issuetype: Bug
assignee: gojira
reporter: gojira
assignee: GoJira
reporter: GoJira
blockers:
depends: $issue[To Do]
priority: Medium
+2 -2
View File
@@ -38,8 +38,8 @@ status: To Do
summary: summary
project: BASIC
issuetype: Bug
assignee: gojira
reporter: gojira
assignee: GoJira
reporter: GoJira
priority: Medium
votes: 0
description: |
+1 -1
View File
@@ -36,7 +36,7 @@ EOF
###############################################################################
RUNS $jira worklog $issue
DIFF <<EOF
- # gojira, a minute ago
- # GoJira, a minute ago
comment: work is hard
started: 2017-01-29T06:17:00.000-0800
timeSpent: 1h 12m
+1 -1
View File
@@ -75,6 +75,6 @@ DIFF <<EOF
+------------+---------+------+----------+--------+----------+----------+----------+
| Issue | Summary | Type | Priority | Status | Age | Reporter | Assignee |
+------------+---------+------+----------+--------+----------+----------+----------+
| $issue | summary | Bug | Medium | To Do | a minute | gojira | gojira |
| $issue | summary | Bug | Medium | To Do | a minute | GoJira | GoJira |
+------------+---------+------+----------+--------+----------+----------+----------+
EOF
+3 -3
View File
@@ -72,8 +72,8 @@ DIFF<<EOF
+------------+---------+------+----------+--------+----------+----------+----------+
| Issue | Summary | Type | Priority | Status | Age | Reporter | Assignee |
+------------+---------+------+----------+--------+----------+----------+----------+
| $issue1 | summary | Bug | Medium | To Do | a minute | gojira | gojira |
| $issue2 | summary | Bug | Medium | To Do | a minute | gojira | gojira |
| $issue1 | summary | Bug | Medium | To Do | a minute | GoJira | GoJira |
| $issue2 | summary | Bug | Medium | To Do | a minute | GoJira | GoJira |
+------------+---------+------+----------+--------+----------+----------+----------+
EOF
@@ -95,7 +95,7 @@ DIFF<<EOF
+------------+---------+------+----------+--------+----------+----------+----------+
| Issue | Summary | Type | Priority | Status | Age | Reporter | Assignee |
+------------+---------+------+----------+--------+----------+----------+----------+
| $issue2 | summary | Bug | Medium | To Do | a minute | gojira | gojira |
| $issue2 | summary | Bug | Medium | To Do | a minute | GoJira | GoJira |
+------------+---------+------+----------+--------+----------+----------+----------+
EOF
+6 -6
View File
@@ -62,9 +62,9 @@ DIFF <<EOF
+-------+-------------+---------+--------+----------+
| id | filename | bytes | user | created |
+-------+-------------+---------+--------+----------+
| $attach1 | README.md | 1239 | gojira | a minute |
| $attach2 | garbage.bin | 1048576 | gojira | a minute |
| $attach3 | foobar.bin | 1048576 | gojira | a minute |
| $attach1 | README.md | 1239 | GoJira | a minute |
| $attach2 | garbage.bin | 1048576 | GoJira | a minute |
| $attach3 | foobar.bin | 1048576 | GoJira | a minute |
+-------+-------------+---------+--------+----------+
EOF
@@ -149,8 +149,8 @@ DIFF <<EOF
+-------+-------------+---------+--------+----------+
| id | filename | bytes | user | created |
+-------+-------------+---------+--------+----------+
| $attach2 | garbage.bin | 1048576 | gojira | a minute |
| $attach3 | foobar.bin | 1048576 | gojira | a minute |
| $attach2 | garbage.bin | 1048576 | GoJira | a minute |
| $attach3 | foobar.bin | 1048576 | GoJira | a minute |
+-------+-------------+---------+--------+----------+
EOF
@@ -168,7 +168,7 @@ DIFF <<EOF
+-------+------------+---------+--------+----------+
| id | filename | bytes | user | created |
+-------+------------+---------+--------+----------+
| $attach3 | foobar.bin | 1048576 | gojira | a minute |
| $attach3 | foobar.bin | 1048576 | GoJira | a minute |
+-------+------------+---------+--------+----------+
EOF
+28 -28
View File
@@ -35,8 +35,8 @@ status: To Do
summary: summary
project: SCRUM
issuetype: Bug
assignee: gojira
reporter: gojira
assignee: GoJira
reporter: GoJira
priority: Medium
votes: 0
description: |
@@ -114,8 +114,8 @@ status: To Do
summary: summary
project: SCRUM
issuetype: Bug
assignee: gojira
reporter: gojira
assignee: GoJira
reporter: GoJira
blockers:
depends: $dup[Done]
priority: Medium
@@ -161,8 +161,8 @@ status: To Do
summary: summary
project: SCRUM
issuetype: Bug
assignee: gojira
reporter: gojira
assignee: GoJira
reporter: GoJira
blockers: $blocker[To Do]
depends: $dup[Done]
priority: Medium
@@ -207,8 +207,8 @@ status: To Do
summary: summary
project: SCRUM
issuetype: Bug
assignee: gojira
reporter: gojira
assignee: GoJira
reporter: GoJira
blockers: $blocker[To Do]
depends: $dup[Done]
priority: Medium
@@ -234,8 +234,8 @@ status: To Do
summary: summary
project: SCRUM
issuetype: Bug
assignee: gojira
reporter: gojira
assignee: GoJira
reporter: GoJira
blockers: $blocker[To Do]
depends: $dup[Done]
priority: Medium
@@ -254,10 +254,10 @@ OK $issue $ENDPOINT/browse/$issue
EOF
# FIXME we probably need a watchers command to wrap this?
RUNS sh -c "$jira req /rest/api/2/issue/$issue/watchers | jq -r .watchers[].name | sort"
RUNS sh -c "$jira req /rest/api/2/issue/$issue/watchers | jq -r .watchers[].displayName | sort"
DIFF <<EOF
gojira
mothra
GoJira
Mothra
EOF
###############################################################################
@@ -326,8 +326,8 @@ status: To Do
summary: summary
project: SCRUM
issuetype: Bug
assignee: gojira
reporter: gojira
assignee: GoJira
reporter: GoJira
blockers: $blocker[Done]
depends: $dup[Done]
priority: Medium
@@ -353,8 +353,8 @@ status: To Do
summary: summary
project: SCRUM
issuetype: Bug
assignee: gojira
reporter: gojira
assignee: GoJira
reporter: GoJira
blockers: $blocker[Done]
depends: $dup[Done]
priority: Medium
@@ -363,7 +363,7 @@ description: |
description
comments:
- | # mothra, a minute ago
- | # Mothra, a minute ago
Yo, Comment
EOF
@@ -385,8 +385,8 @@ status: Done
summary: blocks
project: SCRUM
issuetype: Bug
assignee: gojira
reporter: gojira
assignee: GoJira
reporter: GoJira
blockers:
depends: $issue[To Do]
priority: Medium
@@ -413,8 +413,8 @@ status: Done
summary: blocks
project: SCRUM
issuetype: Bug
assignee: gojira
reporter: gojira
assignee: GoJira
reporter: GoJira
blockers:
depends: $issue[To Do]
priority: Medium
@@ -441,8 +441,8 @@ status: Done
summary: blocks
project: SCRUM
issuetype: Bug
assignee: gojira
reporter: gojira
assignee: GoJira
reporter: GoJira
blockers:
depends: $issue[To Do]
priority: Medium
@@ -469,8 +469,8 @@ status: Done
summary: blocks
project: SCRUM
issuetype: Bug
assignee: mothra
reporter: gojira
assignee: Mothra
reporter: GoJira
blockers:
depends: $issue[To Do]
priority: Medium
@@ -497,8 +497,8 @@ status: Done
summary: blocks
project: SCRUM
issuetype: Bug
assignee: gojira
reporter: gojira
assignee: GoJira
reporter: GoJira
blockers:
depends: $issue[To Do]
priority: Medium
+28 -28
View File
@@ -35,8 +35,8 @@ status: Backlog
summary: summary
project: KANBAN
issuetype: Bug
assignee: gojira
reporter: gojira
assignee: GoJira
reporter: GoJira
priority: Medium
votes: 0
description: |
@@ -114,8 +114,8 @@ status: Backlog
summary: summary
project: KANBAN
issuetype: Bug
assignee: gojira
reporter: gojira
assignee: GoJira
reporter: GoJira
blockers:
depends: $dup[Done]
priority: Medium
@@ -161,8 +161,8 @@ status: Backlog
summary: summary
project: KANBAN
issuetype: Bug
assignee: gojira
reporter: gojira
assignee: GoJira
reporter: GoJira
blockers: $blocker[Backlog]
depends: $dup[Done]
priority: Medium
@@ -207,8 +207,8 @@ status: Backlog
summary: summary
project: KANBAN
issuetype: Bug
assignee: gojira
reporter: gojira
assignee: GoJira
reporter: GoJira
blockers: $blocker[Backlog]
depends: $dup[Done]
priority: Medium
@@ -234,8 +234,8 @@ status: Backlog
summary: summary
project: KANBAN
issuetype: Bug
assignee: gojira
reporter: gojira
assignee: GoJira
reporter: GoJira
blockers: $blocker[Backlog]
depends: $dup[Done]
priority: Medium
@@ -254,10 +254,10 @@ OK $issue $ENDPOINT/browse/$issue
EOF
# FIXME we probably need a watchers command to wrap this?
RUNS sh -c "$jira req /rest/api/2/issue/$issue/watchers | jq -r .watchers[].name | sort"
RUNS sh -c "$jira req /rest/api/2/issue/$issue/watchers | jq -r .watchers[].displayName | sort"
DIFF <<EOF
gojira
mothra
GoJira
Mothra
EOF
###############################################################################
@@ -335,8 +335,8 @@ status: Backlog
summary: summary
project: KANBAN
issuetype: Bug
assignee: gojira
reporter: gojira
assignee: GoJira
reporter: GoJira
blockers: $blocker[Done]
depends: $dup[Done]
priority: Medium
@@ -362,8 +362,8 @@ status: Backlog
summary: summary
project: KANBAN
issuetype: Bug
assignee: gojira
reporter: gojira
assignee: GoJira
reporter: GoJira
blockers: $blocker[Done]
depends: $dup[Done]
priority: Medium
@@ -372,7 +372,7 @@ description: |
description
comments:
- | # mothra, a minute ago
- | # Mothra, a minute ago
Yo, Comment
EOF
@@ -394,8 +394,8 @@ status: Done
summary: blocks
project: KANBAN
issuetype: Bug
assignee: gojira
reporter: gojira
assignee: GoJira
reporter: GoJira
blockers:
depends: $issue[Backlog]
priority: Medium
@@ -422,8 +422,8 @@ status: Done
summary: blocks
project: KANBAN
issuetype: Bug
assignee: gojira
reporter: gojira
assignee: GoJira
reporter: GoJira
blockers:
depends: $issue[Backlog]
priority: Medium
@@ -450,8 +450,8 @@ status: Done
summary: blocks
project: KANBAN
issuetype: Bug
assignee: gojira
reporter: gojira
assignee: GoJira
reporter: GoJira
blockers:
depends: $issue[Backlog]
priority: Medium
@@ -478,8 +478,8 @@ status: Done
summary: blocks
project: KANBAN
issuetype: Bug
assignee: mothra
reporter: gojira
assignee: Mothra
reporter: GoJira
blockers:
depends: $issue[Backlog]
priority: Medium
@@ -506,8 +506,8 @@ status: Done
summary: blocks
project: KANBAN
issuetype: Bug
assignee: gojira
reporter: gojira
assignee: GoJira
reporter: GoJira
blockers:
depends: $issue[Backlog]
priority: Medium
+30 -30
View File
@@ -35,8 +35,8 @@ status: To Do
summary: summary
project: PROJECT
issuetype: Task
assignee: gojira
reporter: gojira
assignee: GoJira
reporter: GoJira
priority: Medium
votes: 0
description: |
@@ -114,8 +114,8 @@ status: To Do
summary: summary
project: PROJECT
issuetype: Task
assignee: gojira
reporter: gojira
assignee: GoJira
reporter: GoJira
blockers:
depends: $dup[Done]
priority: Medium
@@ -161,8 +161,8 @@ status: To Do
summary: summary
project: PROJECT
issuetype: Task
assignee: gojira
reporter: gojira
assignee: GoJira
reporter: GoJira
blockers: $blocker[To Do]
depends: $dup[Done]
priority: Medium
@@ -207,8 +207,8 @@ status: To Do
summary: summary
project: PROJECT
issuetype: Task
assignee: gojira
reporter: gojira
assignee: GoJira
reporter: GoJira
blockers: $blocker[To Do]
depends: $dup[Done]
priority: Medium
@@ -234,8 +234,8 @@ status: To Do
summary: summary
project: PROJECT
issuetype: Task
assignee: gojira
reporter: gojira
assignee: GoJira
reporter: GoJira
blockers: $blocker[To Do]
depends: $dup[Done]
priority: Medium
@@ -254,10 +254,10 @@ OK $issue $ENDPOINT/browse/$issue
EOF
# FIXME we probably need a watchers command to wrap this?
RUNS sh -c "$jira req /rest/api/2/issue/$issue/watchers | jq -r .watchers[].name | sort"
RUNS sh -c "$jira req /rest/api/2/issue/$issue/watchers | jq -r .watchers[].displayName | sort"
DIFF <<EOF
gojira
mothra
GoJira
Mothra
EOF
###############################################################################
@@ -296,8 +296,8 @@ status: In Progress
summary: blocks
project: PROJECT
issuetype: Task
assignee: mothra
reporter: gojira
assignee: Mothra
reporter: GoJira
blockers:
depends: $issue[To Do]
priority: Medium
@@ -337,8 +337,8 @@ status: To Do
summary: summary
project: PROJECT
issuetype: Task
assignee: gojira
reporter: gojira
assignee: GoJira
reporter: GoJira
blockers: $blocker[Done]
depends: $dup[Done]
priority: Medium
@@ -364,8 +364,8 @@ status: To Do
summary: summary
project: PROJECT
issuetype: Task
assignee: gojira
reporter: gojira
assignee: GoJira
reporter: GoJira
blockers: $blocker[Done]
depends: $dup[Done]
priority: Medium
@@ -374,7 +374,7 @@ description: |
description
comments:
- | # mothra, a minute ago
- | # Mothra, a minute ago
Yo, Comment
EOF
@@ -396,8 +396,8 @@ status: Done
summary: blocks
project: PROJECT
issuetype: Task
assignee: mothra
reporter: gojira
assignee: Mothra
reporter: GoJira
blockers:
depends: $issue[To Do]
priority: Medium
@@ -424,8 +424,8 @@ status: Done
summary: blocks
project: PROJECT
issuetype: Task
assignee: mothra
reporter: gojira
assignee: Mothra
reporter: GoJira
blockers:
depends: $issue[To Do]
priority: Medium
@@ -452,8 +452,8 @@ status: Done
summary: blocks
project: PROJECT
issuetype: Task
assignee: mothra
reporter: gojira
assignee: Mothra
reporter: GoJira
blockers:
depends: $issue[To Do]
priority: Medium
@@ -480,8 +480,8 @@ status: Done
summary: blocks
project: PROJECT
issuetype: Task
assignee: gojira
reporter: gojira
assignee: GoJira
reporter: GoJira
blockers:
depends: $issue[To Do]
priority: Medium
@@ -508,8 +508,8 @@ status: Done
summary: blocks
project: PROJECT
issuetype: Task
assignee: mothra
reporter: gojira
assignee: Mothra
reporter: GoJira
blockers:
depends: $issue[To Do]
priority: Medium
+28 -28
View File
@@ -36,8 +36,8 @@ status: Open
summary: summary
project: PROCESS
issuetype: Task
assignee: gojira
reporter: gojira
assignee: GoJira
reporter: GoJira
priority: Medium
votes: 0
description: |
@@ -123,8 +123,8 @@ status: Open
summary: summary
project: PROCESS
issuetype: Task
assignee: gojira
reporter: gojira
assignee: GoJira
reporter: GoJira
blockers:
depends: $dup[Cancelled]
priority: Medium
@@ -170,8 +170,8 @@ status: Open
summary: summary
project: PROCESS
issuetype: Task
assignee: gojira
reporter: gojira
assignee: GoJira
reporter: GoJira
blockers: $blocker[Open]
depends: $dup[Cancelled]
priority: Medium
@@ -216,8 +216,8 @@ status: Open
summary: summary
project: PROCESS
issuetype: Task
assignee: gojira
reporter: gojira
assignee: GoJira
reporter: GoJira
blockers: $blocker[Open]
depends: $dup[Cancelled]
priority: Medium
@@ -243,8 +243,8 @@ status: Open
summary: summary
project: PROCESS
issuetype: Task
assignee: gojira
reporter: gojira
assignee: GoJira
reporter: GoJira
blockers: $blocker[Open]
depends: $dup[Cancelled]
priority: Medium
@@ -263,10 +263,10 @@ OK $issue $ENDPOINT/browse/$issue
EOF
# FIXME we probably need a watchers command to wrap this?
RUNS sh -c "$jira req /rest/api/2/issue/$issue/watchers | jq -r .watchers[].name | sort"
RUNS sh -c "$jira req /rest/api/2/issue/$issue/watchers | jq -r .watchers[].displayName | sort"
DIFF <<EOF
gojira
mothra
GoJira
Mothra
EOF
###############################################################################
@@ -328,8 +328,8 @@ status: Open
summary: summary
project: PROCESS
issuetype: Task
assignee: gojira
reporter: gojira
assignee: GoJira
reporter: GoJira
blockers: $blocker[Open]
depends: $dup[Cancelled]
priority: Medium
@@ -355,8 +355,8 @@ status: Open
summary: summary
project: PROCESS
issuetype: Task
assignee: gojira
reporter: gojira
assignee: GoJira
reporter: GoJira
blockers: $blocker[Open]
depends: $dup[Cancelled]
priority: Medium
@@ -365,7 +365,7 @@ description: |
description
comments:
- | # mothra, a minute ago
- | # Mothra, a minute ago
Yo, Comment
EOF
@@ -387,8 +387,8 @@ status: Open
summary: blocks
project: PROCESS
issuetype: Task
assignee: gojira
reporter: gojira
assignee: GoJira
reporter: GoJira
blockers:
depends: $issue[Open]
priority: Medium
@@ -415,8 +415,8 @@ status: Open
summary: blocks
project: PROCESS
issuetype: Task
assignee: gojira
reporter: gojira
assignee: GoJira
reporter: GoJira
blockers:
depends: $issue[Open]
priority: Medium
@@ -443,8 +443,8 @@ status: Open
summary: blocks
project: PROCESS
issuetype: Task
assignee: gojira
reporter: gojira
assignee: GoJira
reporter: GoJira
blockers:
depends: $issue[Open]
priority: Medium
@@ -471,8 +471,8 @@ status: Open
summary: blocks
project: PROCESS
issuetype: Task
assignee: mothra
reporter: gojira
assignee: Mothra
reporter: GoJira
blockers:
depends: $issue[Open]
priority: Medium
@@ -499,8 +499,8 @@ status: Open
summary: blocks
project: PROCESS
issuetype: Task
assignee: gojira
reporter: gojira
assignee: GoJira
reporter: GoJira
blockers:
depends: $issue[Open]
priority: Medium
+28 -28
View File
@@ -35,8 +35,8 @@ status: To Do
summary: summary
project: TASK
issuetype: Task
assignee: gojira
reporter: gojira
assignee: GoJira
reporter: GoJira
priority: Medium
votes: 0
description: |
@@ -116,8 +116,8 @@ status: To Do
summary: summary
project: TASK
issuetype: Task
assignee: gojira
reporter: gojira
assignee: GoJira
reporter: GoJira
blockers:
depends: $dup[Done]
priority: Medium
@@ -163,8 +163,8 @@ status: To Do
summary: summary
project: TASK
issuetype: Task
assignee: gojira
reporter: gojira
assignee: GoJira
reporter: GoJira
blockers: $blocker[To Do]
depends: $dup[Done]
priority: Medium
@@ -209,8 +209,8 @@ status: To Do
summary: summary
project: TASK
issuetype: Task
assignee: gojira
reporter: gojira
assignee: GoJira
reporter: GoJira
blockers: $blocker[To Do]
depends: $dup[Done]
priority: Medium
@@ -236,8 +236,8 @@ status: To Do
summary: summary
project: TASK
issuetype: Task
assignee: gojira
reporter: gojira
assignee: GoJira
reporter: GoJira
blockers: $blocker[To Do]
depends: $dup[Done]
priority: Medium
@@ -256,10 +256,10 @@ OK $issue $ENDPOINT/browse/$issue
EOF
# FIXME we probably need a watchers command to wrap this?
RUNS sh -c "$jira req /rest/api/2/issue/$issue/watchers | jq -r .watchers[].name | sort"
RUNS sh -c "$jira req /rest/api/2/issue/$issue/watchers | jq -r .watchers[].displayName | sort"
DIFF <<EOF
gojira
mothra
GoJira
Mothra
EOF
###############################################################################
@@ -321,8 +321,8 @@ status: To Do
summary: summary
project: TASK
issuetype: Task
assignee: gojira
reporter: gojira
assignee: GoJira
reporter: GoJira
blockers: $blocker[Done]
depends: $dup[Done]
priority: Medium
@@ -348,8 +348,8 @@ status: To Do
summary: summary
project: TASK
issuetype: Task
assignee: gojira
reporter: gojira
assignee: GoJira
reporter: GoJira
blockers: $blocker[Done]
depends: $dup[Done]
priority: Medium
@@ -358,7 +358,7 @@ description: |
description
comments:
- | # mothra, a minute ago
- | # Mothra, a minute ago
Yo, Comment
EOF
@@ -380,8 +380,8 @@ status: Done
summary: blocks
project: TASK
issuetype: Task
assignee: gojira
reporter: gojira
assignee: GoJira
reporter: GoJira
blockers:
depends: $issue[To Do]
priority: Medium
@@ -408,8 +408,8 @@ status: Done
summary: blocks
project: TASK
issuetype: Task
assignee: gojira
reporter: gojira
assignee: GoJira
reporter: GoJira
blockers:
depends: $issue[To Do]
priority: Medium
@@ -436,8 +436,8 @@ status: Done
summary: blocks
project: TASK
issuetype: Task
assignee: gojira
reporter: gojira
assignee: GoJira
reporter: GoJira
blockers:
depends: $issue[To Do]
priority: Medium
@@ -464,8 +464,8 @@ status: Done
summary: blocks
project: TASK
issuetype: Task
assignee: mothra
reporter: gojira
assignee: Mothra
reporter: GoJira
blockers:
depends: $issue[To Do]
priority: Medium
@@ -492,8 +492,8 @@ status: Done
summary: blocks
project: TASK
issuetype: Task
assignee: gojira
reporter: gojira
assignee: GoJira
reporter: GoJira
blockers:
depends: $issue[To Do]
priority: Medium
+1 -1
View File
@@ -22,7 +22,7 @@ require (
github.com/imdario/mergo v0.3.7 // indirect
github.com/jinzhu/copier v0.0.0-20180308034124-7e38e58719c3
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51
github.com/kr/pretty v0.1.0 // indirect
github.com/kr/pretty v0.1.0
github.com/kr/pty v1.1.4 // indirect
github.com/mattn/go-colorable v0.0.9 // indirect
github.com/mattn/go-isatty v0.0.3 // indirect
+28
View File
@@ -543,6 +543,34 @@ func IssueAssign(ua HttpClient, endpoint string, issue, name string) error {
return responseError(resp)
}
func IssueAssignAccountID(ua HttpClient, endpoint string, issue, acctId string) error {
// this is special, not using the jiradata.User structure
// because we need to be able to send `null` as the name param
// when we want to un-assign the issue
req := struct {
AccountID *string `json:"accountId"`
}{&acctId}
if acctId == "" {
req.AccountID = nil
}
encoded, err := json.Marshal(req)
if err != nil {
return err
}
uri := URLJoin(endpoint, "rest/api/2/issue", issue, "assignee")
resp, err := ua.Put(uri, "application/json", bytes.NewBuffer(encoded))
if err != nil {
return err
}
defer resp.Body.Close()
if resp.StatusCode == 204 {
return nil
}
return responseError(resp)
}
// https://docs.atlassian.com/jira/REST/cloud/#api/2/issue/{issueIdOrKey}/attachments-addAttachment
func (j *Jira) IssueAttachFile(issue, filename string, contents io.Reader) (*jiradata.ListOfAttachment, error) {
return IssueAttachFile(j.UA, j.Endpoint, issue, filename, contents)
+10 -1
View File
@@ -49,6 +49,11 @@ func HandleExit() {
}
}
const (
ServerDeploymentType = "server"
CloudDeploymentType = "cloud"
)
type GlobalOptions struct {
// AuthenticationMethod is the method we use to authenticate with the jira serivce. Possible values are "api-token" or "session".
// The default is "api-token" when the service endpoint ends with "atlassian.net", otherwise it "session". Session authentication
@@ -75,7 +80,7 @@ type GlobalOptions struct {
// PasswordSourcePath can be used to specify the path to the PasswordSource binary to use.
PasswordSourcePath figtree.StringOption `yaml:"password-source-path,omitempty" json:"password-source-path,omitempty"`
// Cached password to avoid invoking password source on each API request
// Cached password to avoid invoking password source on each API request
cachedPassword string
// PasswordDirectory is only used for the "pass" PasswordSource. It is the location for the encrypted password
@@ -102,6 +107,10 @@ type GlobalOptions struct {
// `username` The User property is used on Jira service API calls that require a user to associate with
// an Issue (like assigning a Issue to yourself)
User figtree.StringOption `yaml:"user,omitempty" json:"user,omitempty"`
// JiraDeploymentType can be `cloud` or `server`, if not set it will be inferred from
// the /rest/api/2/serverInfo REST API.
JiraDeploymentType figtree.StringOption `yaml:"jira-deployment-type,omitempty" json:"jira-deployment-type,omitempty"`
}
type CommonOptions struct {
+33 -15
View File
@@ -338,12 +338,12 @@ const defaultTableTemplate = `{{/* table template */ -}}
{{- cell .fields.status.name -}}
{{- cell (.fields.created | age) -}}
{{- if .fields.reporter -}}
{{- cell .fields.reporter.name -}}
{{- cell .fields.reporter.displayName -}}
{{- else -}}
{{- cell "<unknown>" -}}
{{- end -}}
{{- if .fields.assignee -}}
{{- cell .fields.assignee.name -}}
{{- cell .fields.assignee.displayName -}}
{{- else -}}
{{- cell "<unassigned>" -}}
{{- end -}}
@@ -357,7 +357,7 @@ const defaultAttachListTemplate = `{{/* attach list template */ -}}
{{- cell .id -}}
{{- cell .filename -}}
{{- cell .size -}}
{{- cell .author.name -}}
{{- cell .author.displayName -}}
{{- cell (.created | age) -}}
{{- end -}}
`
@@ -379,11 +379,11 @@ components: {{ range .fields.components }}{{ .name }} {{end}}
issuetype: {{ .fields.issuetype.name }}
{{end -}}
{{if .fields.assignee -}}
assignee: {{ .fields.assignee.name }}
assignee: {{ .fields.assignee.displayName }}
{{end -}}
reporter: {{ if .fields.reporter }}{{ .fields.reporter.name }}{{end}}
reporter: {{ if .fields.reporter }}{{ .fields.reporter.displayName }}{{end}}
{{if .fields.customfield_10110 -}}
watchers: {{ range .fields.customfield_10110 }}{{ .name }} {{end}}
watchers: {{ range .fields.customfield_10110 }}{{ .displayName }} {{end}}
{{end -}}
{{if .fields.issuelinks -}}
blockers: {{ range .fields.issuelinks }}{{if .outwardIssue}}{{ .outwardIssue.key }}[{{.outwardIssue.fields.status.name}}]{{end}}{{end}}
@@ -402,7 +402,7 @@ description: |
{{ or .fields.description "" | indent 2 }}
{{if .fields.comment.comments}}
comments:
{{ range .fields.comment.comments }} - | # {{.author.name}}, {{.created | age}} ago
{{ range .fields.comment.comments }} - | # {{.author.displayName}}, {{.created | age}} ago
{{ or .body "" | indent 4}}
{{end}}
{{end -}}
@@ -421,9 +421,15 @@ fields:
components: # Values: {{ range .meta.fields.components.allowedValues }}{{.name}}, {{end}}{{if .overrides.components }}{{ range (split "," .overrides.components)}}
- name: {{.}}{{end}}{{else}}{{ range .fields.components }}
- name: {{ .name }}{{end}}{{end}}{{end}}
{{- if .meta.fields.assignee}}
{{- if .meta.fields.assignee }}
{{- if .overrides.assignee }}
assignee:
name: {{ if .overrides.assignee }}{{.overrides.assignee}}{{else}}{{if .fields.assignee }}{{ .fields.assignee.name }}{{end}}{{end}}{{end}}
name: {{ .overrides.assignee }}
{{- else if .fields.assignee }}
assignee: {{if .fields.assignee.name}}
name: {{ or .fields.assignee.name}}
{{- else }}
displayName: {{.fields.assignee.displayName}}{{end}}{{end}}{{end}}
{{- if .meta.fields.reporter}}
reporter:
name: {{ if .overrides.reporter }}{{ .overrides.reporter }}{{else if .fields.reporter}}{{ .fields.reporter.name }}{{end}}{{end}}
@@ -439,7 +445,7 @@ fields:
{{ or .overrides.description .fields.description "" | indent 4 }}
# votes: {{ .fields.votes.votes }}
# comments:
# {{ range .fields.comment.comments }} - | # {{.author.name}}, {{.created | age}} ago
# {{ range .fields.comment.comments }} - | # {{.author.displayName}}, {{.created | age}} ago
# {{ or .body "" | indent 4 | comment}}
# {{end}}
`
@@ -546,9 +552,15 @@ update:
{{ or .overrides.comment "" | indent 10 }}
{{- end -}}
fields:
{{- if .meta.fields.assignee}}
{{- if .meta.fields.assignee }}
{{- if .overrides.assignee }}
assignee:
name: {{if .overrides.assignee}}{{.overrides.assignee}}{{else}}{{if .fields.assignee}}{{.fields.assignee.name}}{{end}}{{end}}
name: {{ .overrides.assignee }}
{{- else if .fields.assignee }}
assignee: {{if .fields.assignee.name}}
name: {{ or .fields.assignee.name}}
{{- else }}
displayName: {{.fields.assignee.displayName}}{{end}}{{end}}
{{- end -}}
{{if .meta.fields.components}}
components: # Values: {{ range .meta.fields.components.allowedValues }}{{.name}}, {{end}}{{if .overrides.components }}{{ range (split "," .overrides.components)}}
@@ -579,9 +591,15 @@ fields:
priority: # Values: {{ range .meta.fields.priority.allowedValues }}{{.name}}, {{end}}
name: {{ or .overrides.priority "unassigned" }}
{{- end -}}
{{if .meta.fields.reporter}}
{{- if .meta.fields.reporter }}
{{- if .overrides.reporter }}
reporter:
name: {{if .overrides.reporter}}{{.overrides.reporter}}{{else}}{{if .fields.reporter}}{{.fields.reporter.name}}{{end}}{{end}}
name: {{ .overrides.reporter }}
{{- else if .fields.reporter }}
reporter: {{if .fields.reporter.name}}
name: {{ or .fields.reporter.name}}
{{- else }}
displayName: {{.fields.reporter.displayName}}{{end}}{{end}}
{{- end -}}
{{if .meta.fields.resolution}}
resolution: # Values: {{ range .meta.fields.resolution.allowedValues }}{{.name}}, {{end}}
@@ -610,7 +628,7 @@ started: {{ or .started "" }}
`
const defaultWorklogsTemplate = `{{/* worklogs template */ -}}
{{ range .worklogs }}- # {{.author.name}}, {{.created | age}} ago
{{ range .worklogs }}- # {{.author.displayName}}, {{.created | age}} ago
comment: {{ or .comment "" }}
started: {{ .started }}
timeSpent: {{ .timeSpent }}
+28 -1
View File
@@ -2,6 +2,7 @@ package jiracmd
import (
"fmt"
"strings"
"github.com/coryb/figtree"
"github.com/coryb/oreo"
@@ -48,7 +49,33 @@ func CmdAssignUsage(cmd *kingpin.CmdClause, opts *AssignOptions) error {
// CmdAssign will assign an issue to a user
func CmdAssign(o *oreo.Client, globals *jiracli.GlobalOptions, opts *AssignOptions) error {
err := jira.IssueAssign(o, globals.Endpoint.Value, opts.Issue, opts.Assignee)
if globals.JiraDeploymentType.Value == "" {
serverInfo, err := jira.ServerInfo(o, globals.Endpoint.Value)
if err != nil {
return err
}
globals.JiraDeploymentType.Value = strings.ToLower(serverInfo.DeploymentType)
}
assignFunc := jira.IssueAssign
if globals.JiraDeploymentType.Value == jiracli.CloudDeploymentType {
if opts.Assignee != "" && opts.Assignee != "-1" {
users, err := jira.UserSearch(o, globals.Endpoint.Value, &jira.UserSearchOptions{
Username: opts.Assignee,
})
if err != nil {
return err
}
if len(users) > 1 {
return fmt.Errorf("Found %d accounts for users with username %q", len(users), opts.Assignee)
} else if len(users) == 1 {
opts.Assignee = users[0].AccountID
}
}
assignFunc = jira.IssueAssignAccountID
}
err := assignFunc(o, globals.Endpoint.Value, opts.Issue, opts.Assignee)
if err != nil {
return err
}
+15
View File
@@ -3,6 +3,7 @@ package jiracmd
import (
"fmt"
"os"
"strings"
"github.com/coryb/figtree"
"github.com/coryb/oreo"
@@ -62,6 +63,14 @@ func CmdCreateUsage(cmd *kingpin.CmdClause, opts *CreateOptions) error {
// CmdCreate sends the create-metadata to the "create" template for editing, then
// will parse the edited document as YAML and submit the document to jira.
func CmdCreate(o *oreo.Client, globals *jiracli.GlobalOptions, opts *CreateOptions) error {
if globals.JiraDeploymentType.Value == "" {
serverInfo, err := jira.ServerInfo(o, globals.Endpoint.Value)
if err != nil {
return err
}
globals.JiraDeploymentType.Value = strings.ToLower(serverInfo.DeploymentType)
}
type templateInput struct {
Meta *jiradata.IssueType `yaml:"meta" json:"meta"`
Overrides map[string]string `yaml:"overrides" json:"overrides"`
@@ -86,6 +95,12 @@ func CmdCreate(o *oreo.Client, globals *jiracli.GlobalOptions, opts *CreateOptio
var issueResp *jiradata.IssueCreateResponse
err = jiracli.EditLoop(&opts.CommonOptions, &input, &issueUpdate, func() error {
if globals.JiraDeploymentType.Value == jiracli.CloudDeploymentType {
err := fixGDPRUserFields(o, globals.Endpoint.Value, createMeta.Fields, issueUpdate.Fields)
if err != nil {
return err
}
}
issueResp, err = jira.CreateIssue(o, globals.Endpoint.Value, &issueUpdate)
return err
})
+108
View File
@@ -2,6 +2,7 @@ package jiracmd
import (
"fmt"
"strings"
"github.com/coryb/figtree"
"github.com/coryb/oreo"
@@ -71,6 +72,14 @@ func CmdEditUsage(cmd *kingpin.CmdClause, opts *EditOptions, fig *figtree.FigTre
// Edit will get issue data and send to "edit" template
func CmdEdit(o *oreo.Client, globals *jiracli.GlobalOptions, opts *EditOptions) error {
if globals.JiraDeploymentType.Value == "" {
serverInfo, err := jira.ServerInfo(o, globals.Endpoint.Value)
if err != nil {
return err
}
globals.JiraDeploymentType.Value = strings.ToLower(serverInfo.DeploymentType)
}
type templateInput struct {
*jiradata.Issue `yaml:",inline"`
Meta *jiradata.EditMeta `yaml:"meta" json:"meta"`
@@ -93,6 +102,12 @@ func CmdEdit(o *oreo.Client, globals *jiracli.GlobalOptions, opts *EditOptions)
Overrides: opts.Overrides,
}
err = jiracli.EditLoop(&opts.CommonOptions, &input, &issueUpdate, func() error {
if globals.JiraDeploymentType.Value == jiracli.CloudDeploymentType {
err := fixGDPRUserFields(o, globals.Endpoint.Value, editMeta.Fields, issueUpdate.Fields)
if err != nil {
return err
}
}
return jira.EditIssue(o, globals.Endpoint.Value, opts.Issue, &issueUpdate)
})
if err != nil {
@@ -123,6 +138,12 @@ func CmdEdit(o *oreo.Client, globals *jiracli.GlobalOptions, opts *EditOptions)
Overrides: opts.Overrides,
}
err = jiracli.EditLoop(&opts.CommonOptions, &input, &issueUpdate, func() error {
if globals.JiraDeploymentType.Value == jiracli.CloudDeploymentType {
err := fixGDPRUserFields(o, globals.Endpoint.Value, editMeta.Fields, issueUpdate.Fields)
if err != nil {
return err
}
}
return jira.EditIssue(o, globals.Endpoint.Value, issueData.Key, &issueUpdate)
})
if err == jiracli.EditLoopAbort && len(results.Issues) > i+1 {
@@ -152,3 +173,90 @@ func CmdEdit(o *oreo.Client, globals *jiracli.GlobalOptions, opts *EditOptions)
}
return nil
}
func fixUserField(ua jira.HttpClient, endpoint string, userField map[string]interface{}) error {
if _, ok := userField["accountId"].(string); ok {
// this field is already GDPR ready
return nil
}
if username, ok := userField["name"].(string); ok {
users, err := jira.UserSearch(ua, endpoint, &jira.UserSearchOptions{
Username: username,
})
if err != nil {
return err
}
if len(users) != 1 {
return fmt.Errorf("Found %d accounts for username %q", len(users), username)
}
userField["accountId"] = users[0].AccountID
return nil
}
queryName, ok := userField["displayName"].(string)
if !ok {
queryName, ok = userField["emailAddress"].(string)
if !ok {
// no fields to search on, skip user lookup
return nil
}
}
users, err := jira.UserSearch(ua, endpoint, &jira.UserSearchOptions{
// Query field will search users displayName and emailAddress
Query: queryName,
})
if err != nil {
return err
}
if len(users) != 1 {
return fmt.Errorf("Found %d accounts for users with query %q", len(users), queryName)
}
userField["accountId"] = users[0].AccountID
return nil
}
func fixGDPRUserFields(ua jira.HttpClient, endpoint string, meta jiradata.FieldMetaMap, fields map[string]interface{}) error {
for fieldName, fieldMeta := range meta {
// check to see if meta-field is in fields data, otherwise skip
if _, ok := fields[fieldName]; !ok {
continue
}
if fieldMeta.Schema.Type == "user" {
userField, ok := fields[fieldName].(map[string]interface{})
if !ok {
// for some reason the field seems to be the wrong type in the data
// even though the schema is a "user"
continue
}
err := fixUserField(ua, endpoint, userField)
if err != nil {
return err
}
fields[fieldName] = userField
}
if fieldMeta.Schema.Type == "array" && fieldMeta.Schema.Items == "user" {
listUserField, ok := fields[fieldName].([]interface{})
if !ok {
// for some reason the field seems to be the wrong type in the data
// even though the schema is a list of "user"
continue
}
for i, userFieldItem := range listUserField {
userField, ok := userFieldItem.(map[string]interface{})
if !ok {
// for some reason the field seems to be the wrong type in the data
// even though the schema is a "user"
continue
}
err := fixUserField(ua, endpoint, userField)
if err != nil {
return err
}
listUserField[i] = userField
}
fields[fieldName] = listUserField
}
}
return nil
}
+15
View File
@@ -2,6 +2,7 @@ package jiracmd
import (
"fmt"
"strings"
"github.com/coryb/figtree"
"github.com/coryb/oreo"
@@ -63,6 +64,14 @@ func CmdSubtaskUsage(cmd *kingpin.CmdClause, opts *SubtaskOptions) error {
// CmdSubtask sends the subtask-metadata to the "subtask" template for editing, then
// will parse the edited document as YAML and submit the document to jira.
func CmdSubtask(o *oreo.Client, globals *jiracli.GlobalOptions, opts *SubtaskOptions) error {
if globals.JiraDeploymentType.Value == "" {
serverInfo, err := jira.ServerInfo(o, globals.Endpoint.Value)
if err != nil {
return err
}
globals.JiraDeploymentType.Value = strings.ToLower(serverInfo.DeploymentType)
}
type templateInput struct {
Meta *jiradata.IssueType `yaml:"meta" json:"meta"`
Overrides map[string]string `yaml:"overrides" json:"overrides"`
@@ -101,6 +110,12 @@ func CmdSubtask(o *oreo.Client, globals *jiracli.GlobalOptions, opts *SubtaskOpt
var issueResp *jiradata.IssueCreateResponse
err = jiracli.EditLoop(&opts.CommonOptions, &input, &issueUpdate, func() error {
if globals.JiraDeploymentType.Value == jiracli.CloudDeploymentType {
err := fixGDPRUserFields(o, globals.Endpoint.Value, createMeta.Fields, issueUpdate.Fields)
if err != nil {
return err
}
}
issueResp, err = jira.CreateIssue(o, globals.Endpoint.Value, &issueUpdate)
return err
})
+14
View File
@@ -86,6 +86,14 @@ func defaultResolution(transMeta *jiradata.Transition) string {
// CmdTransition will move state of the given issue to the given transtion
func CmdTransition(o *oreo.Client, globals *jiracli.GlobalOptions, opts *TransitionOptions) error {
if globals.JiraDeploymentType.Value == "" {
serverInfo, err := jira.ServerInfo(o, globals.Endpoint.Value)
if err != nil {
return err
}
globals.JiraDeploymentType.Value = strings.ToLower(serverInfo.DeploymentType)
}
issueData, err := jira.GetIssue(o, globals.Endpoint.Value, opts.Issue, nil)
if err != nil {
return jiracli.CliError(err)
@@ -151,6 +159,12 @@ func CmdTransition(o *oreo.Client, globals *jiracli.GlobalOptions, opts *Transit
Overrides: opts.Overrides,
}
err = jiracli.EditLoop(&opts.CommonOptions, &input, &issueUpdate, func() error {
if globals.JiraDeploymentType.Value == jiracli.CloudDeploymentType {
err := fixGDPRUserFields(o, globals.Endpoint.Value, transMeta.Fields, issueUpdate.Fields)
if err != nil {
return err
}
}
return jira.TransitionIssue(o, globals.Endpoint.Value, opts.Issue, &issueUpdate)
})
if err != nil {
+24
View File
@@ -2,6 +2,7 @@ package jiracmd
import (
"fmt"
"strings"
"github.com/coryb/figtree"
"github.com/coryb/oreo"
@@ -62,6 +63,29 @@ func CmdWatch(o *oreo.Client, globals *jiracli.GlobalOptions, opts *WatchOptions
if opts.Watcher == "" {
opts.Watcher = globals.User.Value
}
if globals.JiraDeploymentType.Value == "" {
serverInfo, err := jira.ServerInfo(o, globals.Endpoint.Value)
if err != nil {
return err
}
globals.JiraDeploymentType.Value = strings.ToLower(serverInfo.DeploymentType)
}
if globals.JiraDeploymentType.Value == jiracli.CloudDeploymentType {
users, err := jira.UserSearch(o, globals.Endpoint.Value, &jira.UserSearchOptions{
Username: opts.Watcher,
})
if err != nil {
return err
}
if len(users) > 1 {
return fmt.Errorf("Found %d accounts for users with username %q", len(users), opts.Watcher)
} else if len(users) == 1 {
opts.Watcher = users[0].AccountID
}
}
if opts.Action == WatcherAdd {
if err := jira.IssueAddWatcher(o, globals.Endpoint.Value, opts.Issue, opts.Watcher); err != nil {
return err
+13
View File
@@ -0,0 +1,13 @@
package jiradata
type ServerInfo struct {
BaseURL string `json:"baseUrl,omitempty" yaml:"baseUrl,omitempty"`
BuildDate string `json:"buildDate,omitempty" yaml:"buildDate,omitempty"`
BuildNumber int `json:"buildNumber,omitempty" yaml:"buildNumber,omitempty"`
DeploymentType string `json:"deploymentType,omitempty" yaml:"deploymentType,omitempty"`
SCMInfo string `json:"scmInfo,omitempty" yaml:"scmInfo,omitempty"`
ServerTime string `json:"serverTime,omitempty" yaml:"serverTime,omitempty"`
ServerTitle string `json:"serverTitle,omitempty" yaml:"serverTitle,omitempty"`
Version string `json:"version,omitempty" yaml:"version,omitempty"`
VersionNumbers []int `json:"versionNumbers,omitempty" yaml:"versionNumbers,omitempty"`
}
+22
View File
@@ -0,0 +1,22 @@
package jira
import (
"encoding/json"
"github.com/go-jira/jira/jiradata"
)
func ServerInfo(ua HttpClient, endpoint string) (*jiradata.ServerInfo, error) {
uri := URLJoin(endpoint, "rest/api/2/serverInfo")
resp, err := ua.GetJSON(uri)
if err != nil {
return nil, err
}
defer resp.Body.Close()
if resp.StatusCode == 200 {
results := jiradata.ServerInfo{}
return &results, json.NewDecoder(resp.Body).Decode(&results)
}
return nil, responseError(resp)
}
+58
View File
@@ -0,0 +1,58 @@
package jira
import (
"encoding/json"
"fmt"
"net/url"
"strings"
"github.com/go-jira/jira/jiradata"
)
type UserSearchOptions struct {
Query string `yaml:"query,omitempty" json:"query,omitempty"`
Username string `yaml:"username,omitempty" json:"username,omitempty"`
AccountID string `yaml:"accountId,omitempty" json:"accountId,omitempty"`
StartAt int `yaml:"startAt,omitempty" json:"startAt,omitempty"`
MaxResults int `yaml:"max-results,omitempty" json:"max-results,omitempty"`
Property string `yaml:"property,omitempty" json:"property,omitempty"`
}
// https://developer.atlassian.com/cloud/jira/platform/rest/v2/#api-rest-api-2-user-search-get
func UserSearch(ua HttpClient, endpoint string, opts *UserSearchOptions) ([]*jiradata.User, error) {
uri := URLJoin(endpoint, "rest/api/2/user/search")
params := []string{}
if opts.Query != "" {
params = append(params, "query="+url.QueryEscape(opts.Query))
}
if opts.Username != "" {
params = append(params, "username="+url.QueryEscape(opts.Username))
}
if opts.AccountID != "" {
params = append(params, "accountId="+url.QueryEscape(opts.AccountID))
}
if opts.StartAt != 0 {
params = append(params, fmt.Sprintf("startAt=%d", opts.StartAt))
}
if opts.MaxResults != 0 {
params = append(params, fmt.Sprintf("maxResults=%d", opts.MaxResults))
}
if opts.Property != "" {
params = append(params, "property="+url.QueryEscape(opts.Property))
}
if len(params) > 0 {
uri += "?" + strings.Join(params, "&")
}
resp, err := ua.GetJSON(uri)
if err != nil {
return nil, err
}
defer resp.Body.Close()
if resp.StatusCode == 200 {
results := []*jiradata.User{}
return results, json.NewDecoder(resp.Body).Decode(&results)
}
return nil, responseError(resp)
}