mirror of
https://github.com/interviewstreet/go-jira.git
synced 2024-11-28 08:39:03 +02:00
Add project and tests
This commit is contained in:
parent
bbc0470766
commit
3b2cee5d9b
9872
json_mocks/all_projects.json
Normal file
9872
json_mocks/all_projects.json
Normal file
File diff suppressed because it is too large
Load Diff
411
json_mocks/project.json
Normal file
411
json_mocks/project.json
Normal file
@ -0,0 +1,411 @@
|
|||||||
|
{
|
||||||
|
"expand": "projectKeys",
|
||||||
|
"self": "https://issues.apache.org/jira/rest/api/2/project/12310505",
|
||||||
|
"id": "12310505",
|
||||||
|
"key": "ABDERA",
|
||||||
|
"description": "The Abdera project is an implementation of the Atom Syndication Format (RFC4287) and the Atom Publishing Protocol specifications published by the IETF Atompub working group.",
|
||||||
|
"lead": {
|
||||||
|
"self": "https://issues.apache.org/jira/rest/api/2/user?username=rooneg",
|
||||||
|
"key": "rooneg",
|
||||||
|
"name": "rooneg",
|
||||||
|
"avatarUrls": {
|
||||||
|
"48x48": "https://issues.apache.org/jira/secure/useravatar?avatarId=10452",
|
||||||
|
"24x24": "https://issues.apache.org/jira/secure/useravatar?size=small&avatarId=10452",
|
||||||
|
"16x16": "https://issues.apache.org/jira/secure/useravatar?size=xsmall&avatarId=10452",
|
||||||
|
"32x32": "https://issues.apache.org/jira/secure/useravatar?size=medium&avatarId=10452"
|
||||||
|
},
|
||||||
|
"displayName": "Garrett Rooney",
|
||||||
|
"active": true
|
||||||
|
},
|
||||||
|
"components": [],
|
||||||
|
"issueTypes": [
|
||||||
|
{
|
||||||
|
"self": "https://issues.apache.org/jira/rest/api/2/issuetype/1",
|
||||||
|
"id": "1",
|
||||||
|
"description": "A problem which impairs or prevents the functions of the product.",
|
||||||
|
"iconUrl": "https://issues.apache.org/jira/images/icons/issuetypes/bug.png",
|
||||||
|
"name": "Bug",
|
||||||
|
"subtask": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"self": "https://issues.apache.org/jira/rest/api/2/issuetype/2",
|
||||||
|
"id": "2",
|
||||||
|
"description": "A new feature of the product, which has yet to be developed.",
|
||||||
|
"iconUrl": "https://issues.apache.org/jira/images/icons/issuetypes/newfeature.png",
|
||||||
|
"name": "New Feature",
|
||||||
|
"subtask": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"self": "https://issues.apache.org/jira/rest/api/2/issuetype/4",
|
||||||
|
"id": "4",
|
||||||
|
"description": "An improvement or enhancement to an existing feature or task.",
|
||||||
|
"iconUrl": "https://issues.apache.org/jira/images/icons/issuetypes/improvement.png",
|
||||||
|
"name": "Improvement",
|
||||||
|
"subtask": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"self": "https://issues.apache.org/jira/rest/api/2/issuetype/6",
|
||||||
|
"id": "6",
|
||||||
|
"description": "A new unit, integration or system test.",
|
||||||
|
"iconUrl": "https://issues.apache.org/jira/images/icons/issuetypes/requirement.png",
|
||||||
|
"name": "Test",
|
||||||
|
"subtask": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"self": "https://issues.apache.org/jira/rest/api/2/issuetype/5",
|
||||||
|
"id": "5",
|
||||||
|
"description": "General wishlist item.",
|
||||||
|
"iconUrl": "https://issues.apache.org/jira/images/icons/issuetypes/improvement.png",
|
||||||
|
"name": "Wish",
|
||||||
|
"subtask": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"self": "https://issues.apache.org/jira/rest/api/2/issuetype/3",
|
||||||
|
"id": "3",
|
||||||
|
"description": "A task that needs to be done.",
|
||||||
|
"iconUrl": "https://issues.apache.org/jira/images/icons/issuetypes/task.png",
|
||||||
|
"name": "Task",
|
||||||
|
"subtask": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"self": "https://issues.apache.org/jira/rest/api/2/issuetype/7",
|
||||||
|
"id": "7",
|
||||||
|
"description": "The sub-task of the issue",
|
||||||
|
"iconUrl": "https://issues.apache.org/jira/images/icons/issuetypes/subtask_alternate.png",
|
||||||
|
"name": "Sub-task",
|
||||||
|
"subtask": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"self": "https://issues.apache.org/jira/rest/api/2/issuetype/8",
|
||||||
|
"id": "8",
|
||||||
|
"description": "A request for a new JIRA project to be set up",
|
||||||
|
"iconUrl": "https://issues.apache.org/jira/images/icons/jiraman18.gif",
|
||||||
|
"name": "New JIRA Project",
|
||||||
|
"subtask": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"self": "https://issues.apache.org/jira/rest/api/2/issuetype/9",
|
||||||
|
"id": "9",
|
||||||
|
"description": "An RTC request",
|
||||||
|
"iconUrl": "https://issues.apache.org/jira/images/icons/issuetypes/newfeature.png",
|
||||||
|
"name": "RTC",
|
||||||
|
"subtask": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"self": "https://issues.apache.org/jira/rest/api/2/issuetype/10",
|
||||||
|
"id": "10",
|
||||||
|
"description": "Challenges made against the Sun Compatibility Test Suite",
|
||||||
|
"iconUrl": "https://issues.apache.org/jira/images/icons/issuetypes/task.png",
|
||||||
|
"name": "TCK Challenge",
|
||||||
|
"subtask": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"self": "https://issues.apache.org/jira/rest/api/2/issuetype/11",
|
||||||
|
"id": "11",
|
||||||
|
"description": "A formal question. Initially added for the Legal JIRA.",
|
||||||
|
"iconUrl": "https://issues.apache.org/jira/images/icons/issuetypes/genericissue.png",
|
||||||
|
"name": "Question",
|
||||||
|
"subtask": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"self": "https://issues.apache.org/jira/rest/api/2/issuetype/12",
|
||||||
|
"id": "12",
|
||||||
|
"description": "",
|
||||||
|
"iconUrl": "https://issues.apache.org/jira/images/icons/issuetypes/genericissue.png",
|
||||||
|
"name": "Temp",
|
||||||
|
"subtask": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"self": "https://issues.apache.org/jira/rest/api/2/issuetype/13",
|
||||||
|
"id": "13",
|
||||||
|
"description": "A place to record back and forth on notions not yet formed enough to make a 'New Feature' or 'Task'",
|
||||||
|
"iconUrl": "https://issues.apache.org/jira/images/icons/issuetypes/genericissue.png",
|
||||||
|
"name": "Brainstorming",
|
||||||
|
"subtask": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"self": "https://issues.apache.org/jira/rest/api/2/issuetype/14",
|
||||||
|
"id": "14",
|
||||||
|
"description": "An overarching type made of sub-tasks",
|
||||||
|
"iconUrl": "https://issues.apache.org/jira/images/icons/issuetypes/genericissue.png",
|
||||||
|
"name": "Umbrella",
|
||||||
|
"subtask": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"self": "https://issues.apache.org/jira/rest/api/2/issuetype/15",
|
||||||
|
"id": "15",
|
||||||
|
"description": "Created by JIRA Agile - do not edit or delete. Issue type for a big user story that needs to be broken down.",
|
||||||
|
"iconUrl": "https://issues.apache.org/jira/images/icons/issuetypes/epic.png",
|
||||||
|
"name": "Epic",
|
||||||
|
"subtask": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"self": "https://issues.apache.org/jira/rest/api/2/issuetype/16",
|
||||||
|
"id": "16",
|
||||||
|
"description": "Created by JIRA Agile - do not edit or delete. Issue type for a user story.",
|
||||||
|
"iconUrl": "https://issues.apache.org/jira/images/icons/issuetypes/story.png",
|
||||||
|
"name": "Story",
|
||||||
|
"subtask": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"self": "https://issues.apache.org/jira/rest/api/2/issuetype/17",
|
||||||
|
"id": "17",
|
||||||
|
"description": "A technical task.",
|
||||||
|
"iconUrl": "https://issues.apache.org/jira/images/icons/issuetypes/task_agile.png",
|
||||||
|
"name": "Technical task",
|
||||||
|
"subtask": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"self": "https://issues.apache.org/jira/rest/api/2/issuetype/18",
|
||||||
|
"id": "18",
|
||||||
|
"description": "Upgrading a dependency to a newer version",
|
||||||
|
"iconUrl": "https://issues.apache.org/jira/images/icons/issuetypes/improvement.png",
|
||||||
|
"name": "Dependency upgrade",
|
||||||
|
"subtask": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"self": "https://issues.apache.org/jira/rest/api/2/issuetype/19",
|
||||||
|
"id": "19",
|
||||||
|
"description": "A search for a suitable name for an Apache product",
|
||||||
|
"iconUrl": "https://issues.apache.org/jira/images/icons/issuetypes/requirement.png",
|
||||||
|
"name": "Suitable Name Search",
|
||||||
|
"subtask": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"self": "https://issues.apache.org/jira/rest/api/2/issuetype/20",
|
||||||
|
"id": "20",
|
||||||
|
"description": "Documentation or Website",
|
||||||
|
"iconUrl": "https://issues.apache.org/jira/images/icons/issuetypes/documentation.png",
|
||||||
|
"name": "Documentation",
|
||||||
|
"subtask": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"self": "https://issues.apache.org/jira/rest/api/2/issuetype/10000",
|
||||||
|
"id": "10000",
|
||||||
|
"description": "Assigned specifically to Contractors by the VP Infra or or other VP/ Board Member.",
|
||||||
|
"iconUrl": "https://issues.apache.org/jira/images/icons/issuetypes/sales.png",
|
||||||
|
"name": "Planned Work",
|
||||||
|
"subtask": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"self": "https://issues.apache.org/jira/rest/api/2/issuetype/10100",
|
||||||
|
"id": "10100",
|
||||||
|
"description": "A request for a new Confluence Wiki to be set up",
|
||||||
|
"iconUrl": "https://issues.apache.org/jira/secure/viewavatar?size=xsmall&avatarId=23211&avatarType=issuetype",
|
||||||
|
"name": "New Confluence Wiki",
|
||||||
|
"subtask": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"self": "https://issues.apache.org/jira/rest/api/2/issuetype/10200",
|
||||||
|
"id": "10200",
|
||||||
|
"description": "",
|
||||||
|
"iconUrl": "https://issues.apache.org/jira/secure/viewavatar?size=xsmall&avatarId=21140&avatarType=issuetype",
|
||||||
|
"name": "New Git Repo",
|
||||||
|
"subtask": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"self": "https://issues.apache.org/jira/rest/api/2/issuetype/10201",
|
||||||
|
"id": "10201",
|
||||||
|
"description": "",
|
||||||
|
"iconUrl": "https://issues.apache.org/jira/secure/viewavatar?size=xsmall&avatarId=21130&avatarType=issuetype",
|
||||||
|
"name": "Github Integration",
|
||||||
|
"subtask": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"self": "https://issues.apache.org/jira/rest/api/2/issuetype/10202",
|
||||||
|
"id": "10202",
|
||||||
|
"description": "",
|
||||||
|
"iconUrl": "https://issues.apache.org/jira/secure/viewavatar?size=xsmall&avatarId=21130&avatarType=issuetype",
|
||||||
|
"name": "New TLP ",
|
||||||
|
"subtask": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"self": "https://issues.apache.org/jira/rest/api/2/issuetype/10204",
|
||||||
|
"id": "10204",
|
||||||
|
"description": "",
|
||||||
|
"iconUrl": "https://issues.apache.org/jira/secure/viewavatar?size=xsmall&avatarId=21130&avatarType=issuetype",
|
||||||
|
"name": "New TLP - Common Tasks",
|
||||||
|
"subtask": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"self": "https://issues.apache.org/jira/rest/api/2/issuetype/10205",
|
||||||
|
"id": "10205",
|
||||||
|
"description": "",
|
||||||
|
"iconUrl": "https://issues.apache.org/jira/secure/viewavatar?size=xsmall&avatarId=21134&avatarType=issuetype",
|
||||||
|
"name": "SVN->GIT Migration",
|
||||||
|
"subtask": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"self": "https://issues.apache.org/jira/rest/api/2/issuetype/10206",
|
||||||
|
"id": "10206",
|
||||||
|
"description": "",
|
||||||
|
"iconUrl": "https://issues.apache.org/jira/secure/viewavatar?size=xsmall&avatarId=21130&avatarType=issuetype",
|
||||||
|
"name": "Blog - New Blog Request",
|
||||||
|
"subtask": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"self": "https://issues.apache.org/jira/rest/api/2/issuetype/10207",
|
||||||
|
"id": "10207",
|
||||||
|
"description": "",
|
||||||
|
"iconUrl": "https://issues.apache.org/jira/secure/viewavatar?size=xsmall&avatarId=21130&avatarType=issuetype",
|
||||||
|
"name": "Blogs - New Blog User Account Request",
|
||||||
|
"subtask": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"self": "https://issues.apache.org/jira/rest/api/2/issuetype/10208",
|
||||||
|
"id": "10208",
|
||||||
|
"description": "",
|
||||||
|
"iconUrl": "https://issues.apache.org/jira/secure/viewavatar?size=xsmall&avatarId=21130&avatarType=issuetype",
|
||||||
|
"name": "Blogs - Access to Existing Blog",
|
||||||
|
"subtask": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"self": "https://issues.apache.org/jira/rest/api/2/issuetype/10209",
|
||||||
|
"id": "10209",
|
||||||
|
"description": "",
|
||||||
|
"iconUrl": "https://issues.apache.org/jira/secure/viewavatar?size=xsmall&avatarId=21130&avatarType=issuetype",
|
||||||
|
"name": "New Bugzilla Project",
|
||||||
|
"subtask": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"self": "https://issues.apache.org/jira/rest/api/2/issuetype/10210",
|
||||||
|
"id": "10210",
|
||||||
|
"description": "",
|
||||||
|
"iconUrl": "https://issues.apache.org/jira/secure/viewavatar?size=xsmall&avatarId=21130&avatarType=issuetype",
|
||||||
|
"name": "SVN->GIT Mirroring",
|
||||||
|
"subtask": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"self": "https://issues.apache.org/jira/rest/api/2/issuetype/10300",
|
||||||
|
"id": "10300",
|
||||||
|
"description": "For general IT problems and questions. Created by JIRA Service Desk.",
|
||||||
|
"iconUrl": "https://issues.apache.org/jira/servicedesk/issue-type-icons?icon=it-help",
|
||||||
|
"name": "IT Help",
|
||||||
|
"subtask": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"self": "https://issues.apache.org/jira/rest/api/2/issuetype/10301",
|
||||||
|
"id": "10301",
|
||||||
|
"description": "For new system accounts or passwords. Created by JIRA Service Desk.",
|
||||||
|
"iconUrl": "https://issues.apache.org/jira/servicedesk/issue-type-icons?icon=access",
|
||||||
|
"name": "Access",
|
||||||
|
"subtask": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"self": "https://issues.apache.org/jira/rest/api/2/issuetype/10400",
|
||||||
|
"id": "10400",
|
||||||
|
"description": "",
|
||||||
|
"iconUrl": "https://issues.apache.org/jira/images/icons/issuetypes/genericissue.png",
|
||||||
|
"name": "Request",
|
||||||
|
"subtask": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"url": "http://abdera.apache.org",
|
||||||
|
"assigneeType": "UNASSIGNED",
|
||||||
|
"versions": [
|
||||||
|
{
|
||||||
|
"self": "https://issues.apache.org/jira/rest/api/2/version/12312506",
|
||||||
|
"id": "12312506",
|
||||||
|
"name": "0.2.2",
|
||||||
|
"archived": false,
|
||||||
|
"released": true,
|
||||||
|
"releaseDate": "2007-02-19",
|
||||||
|
"userReleaseDate": "19/Feb/07",
|
||||||
|
"projectId": 12310505
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"self": "https://issues.apache.org/jira/rest/api/2/version/12312507",
|
||||||
|
"id": "12312507",
|
||||||
|
"name": "0.3.0",
|
||||||
|
"archived": false,
|
||||||
|
"released": true,
|
||||||
|
"releaseDate": "2007-10-05",
|
||||||
|
"userReleaseDate": "05/Oct/07",
|
||||||
|
"projectId": 12310505
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"self": "https://issues.apache.org/jira/rest/api/2/version/12312825",
|
||||||
|
"id": "12312825",
|
||||||
|
"name": "0.4.0",
|
||||||
|
"archived": false,
|
||||||
|
"released": true,
|
||||||
|
"releaseDate": "2008-04-11",
|
||||||
|
"userReleaseDate": "11/Apr/08",
|
||||||
|
"projectId": 12310505
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"self": "https://issues.apache.org/jira/rest/api/2/version/12313105",
|
||||||
|
"id": "12313105",
|
||||||
|
"name": "1.0",
|
||||||
|
"archived": false,
|
||||||
|
"released": true,
|
||||||
|
"releaseDate": "2010-05-02",
|
||||||
|
"userReleaseDate": "02/May/10",
|
||||||
|
"projectId": 12310505
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"self": "https://issues.apache.org/jira/rest/api/2/version/12314990",
|
||||||
|
"id": "12314990",
|
||||||
|
"name": "1.1",
|
||||||
|
"archived": false,
|
||||||
|
"released": true,
|
||||||
|
"releaseDate": "2010-07-11",
|
||||||
|
"userReleaseDate": "11/Jul/10",
|
||||||
|
"projectId": 12310505
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"self": "https://issues.apache.org/jira/rest/api/2/version/12315922",
|
||||||
|
"id": "12315922",
|
||||||
|
"name": "1.1.1",
|
||||||
|
"archived": false,
|
||||||
|
"released": true,
|
||||||
|
"releaseDate": "2010-12-06",
|
||||||
|
"userReleaseDate": "06/Dec/10",
|
||||||
|
"projectId": 12310505
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"self": "https://issues.apache.org/jira/rest/api/2/version/12316041",
|
||||||
|
"id": "12316041",
|
||||||
|
"name": "1.1.2",
|
||||||
|
"archived": false,
|
||||||
|
"released": true,
|
||||||
|
"releaseDate": "2011-01-15",
|
||||||
|
"userReleaseDate": "15/Jan/11",
|
||||||
|
"projectId": 12310505
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"self": "https://issues.apache.org/jira/rest/api/2/version/12323557",
|
||||||
|
"id": "12323557",
|
||||||
|
"name": "1.1.3",
|
||||||
|
"archived": false,
|
||||||
|
"released": false,
|
||||||
|
"projectId": 12310505
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"self": "https://issues.apache.org/jira/rest/api/2/version/12316141",
|
||||||
|
"id": "12316141",
|
||||||
|
"name": "1.2",
|
||||||
|
"archived": false,
|
||||||
|
"released": false,
|
||||||
|
"projectId": 12310505
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"name": "Abdera",
|
||||||
|
"roles": {
|
||||||
|
"Service Desk Team": "https://issues.apache.org/jira/rest/api/2/project/12310505/role/10251",
|
||||||
|
"Developers": "https://issues.apache.org/jira/rest/api/2/project/12310505/role/10050",
|
||||||
|
"Service Desk Customers": "https://issues.apache.org/jira/rest/api/2/project/12310505/role/10250",
|
||||||
|
"Contributors": "https://issues.apache.org/jira/rest/api/2/project/12310505/role/10010",
|
||||||
|
"PMC": "https://issues.apache.org/jira/rest/api/2/project/12310505/role/10011",
|
||||||
|
"Committers": "https://issues.apache.org/jira/rest/api/2/project/12310505/role/10001",
|
||||||
|
"Administrators": "https://issues.apache.org/jira/rest/api/2/project/12310505/role/10002",
|
||||||
|
"ASF Members": "https://issues.apache.org/jira/rest/api/2/project/12310505/role/10150",
|
||||||
|
"Users": "https://issues.apache.org/jira/rest/api/2/project/12310505/role/10040"
|
||||||
|
},
|
||||||
|
"avatarUrls": {
|
||||||
|
"48x48": "https://issues.apache.org/jira/secure/projectavatar?pid=12310505&avatarId=10011",
|
||||||
|
"24x24": "https://issues.apache.org/jira/secure/projectavatar?size=small&pid=12310505&avatarId=10011",
|
||||||
|
"16x16": "https://issues.apache.org/jira/secure/projectavatar?size=xsmall&pid=12310505&avatarId=10011",
|
||||||
|
"32x32": "https://issues.apache.org/jira/secure/projectavatar?size=medium&pid=12310505&avatarId=10011"
|
||||||
|
}
|
||||||
|
}
|
124
progect.go
124
progect.go
@ -1,6 +1,7 @@
|
|||||||
package jira
|
package jira
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -8,6 +9,7 @@ type ProjectService struct {
|
|||||||
client *Client
|
client *Client
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Project list type
|
||||||
type ProjectList []struct {
|
type ProjectList []struct {
|
||||||
Expand string `json:"expand"`
|
Expand string `json:"expand"`
|
||||||
Self string `json:"self"`
|
Self string `json:"self"`
|
||||||
@ -29,8 +31,107 @@ type ProjectList []struct {
|
|||||||
} `json:"projectCategory,omitempty"`
|
} `json:"projectCategory,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Full project description
|
||||||
|
// Can't name it project because it exist in issue
|
||||||
|
type FullProject struct {
|
||||||
|
Expand string `json:"expand"`
|
||||||
|
Self string `json:"self"`
|
||||||
|
ID string `json:"id"`
|
||||||
|
Key string `json:"key"`
|
||||||
|
Description string `json:"description"`
|
||||||
|
Lead struct {
|
||||||
|
Self string `json:"self"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
AvatarUrls struct {
|
||||||
|
Four8X48 string `json:"48x48"`
|
||||||
|
Two4X24 string `json:"24x24"`
|
||||||
|
One6X16 string `json:"16x16"`
|
||||||
|
Three2X32 string `json:"32x32"`
|
||||||
|
} `json:"avatarUrls"`
|
||||||
|
DisplayName string `json:"displayName"`
|
||||||
|
Active bool `json:"active"`
|
||||||
|
} `json:"lead"`
|
||||||
|
Components []struct {
|
||||||
|
Self string `json:"self"`
|
||||||
|
ID string `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Description string `json:"description"`
|
||||||
|
Lead struct {
|
||||||
|
Self string `json:"self"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
AvatarUrls struct {
|
||||||
|
Four8X48 string `json:"48x48"`
|
||||||
|
Two4X24 string `json:"24x24"`
|
||||||
|
One6X16 string `json:"16x16"`
|
||||||
|
Three2X32 string `json:"32x32"`
|
||||||
|
} `json:"avatarUrls"`
|
||||||
|
DisplayName string `json:"displayName"`
|
||||||
|
Active bool `json:"active"`
|
||||||
|
} `json:"lead"`
|
||||||
|
AssigneeType string `json:"assigneeType"`
|
||||||
|
Assignee struct {
|
||||||
|
Self string `json:"self"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
AvatarUrls struct {
|
||||||
|
Four8X48 string `json:"48x48"`
|
||||||
|
Two4X24 string `json:"24x24"`
|
||||||
|
One6X16 string `json:"16x16"`
|
||||||
|
Three2X32 string `json:"32x32"`
|
||||||
|
} `json:"avatarUrls"`
|
||||||
|
DisplayName string `json:"displayName"`
|
||||||
|
Active bool `json:"active"`
|
||||||
|
} `json:"assignee"`
|
||||||
|
RealAssigneeType string `json:"realAssigneeType"`
|
||||||
|
RealAssignee struct {
|
||||||
|
Self string `json:"self"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
AvatarUrls struct {
|
||||||
|
Four8X48 string `json:"48x48"`
|
||||||
|
Two4X24 string `json:"24x24"`
|
||||||
|
One6X16 string `json:"16x16"`
|
||||||
|
Three2X32 string `json:"32x32"`
|
||||||
|
} `json:"avatarUrls"`
|
||||||
|
DisplayName string `json:"displayName"`
|
||||||
|
Active bool `json:"active"`
|
||||||
|
} `json:"realAssignee"`
|
||||||
|
IsAssigneeTypeValid bool `json:"isAssigneeTypeValid"`
|
||||||
|
Project string `json:"project"`
|
||||||
|
ProjectID int `json:"projectId"`
|
||||||
|
} `json:"components"`
|
||||||
|
IssueTypes []struct {
|
||||||
|
Self string `json:"self"`
|
||||||
|
ID string `json:"id"`
|
||||||
|
Description string `json:"description"`
|
||||||
|
IconURL string `json:"iconUrl"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Subtask bool `json:"subtask"`
|
||||||
|
AvatarID int `json:"avatarId"`
|
||||||
|
} `json:"issueTypes"`
|
||||||
|
URL string `json:"url"`
|
||||||
|
Email string `json:"email"`
|
||||||
|
AssigneeType string `json:"assigneeType"`
|
||||||
|
Versions []interface{} `json:"versions"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Roles struct {
|
||||||
|
Developers string `json:"Developers"`
|
||||||
|
} `json:"roles"`
|
||||||
|
AvatarUrls struct {
|
||||||
|
Four8X48 string `json:"48x48"`
|
||||||
|
Two4X24 string `json:"24x24"`
|
||||||
|
One6X16 string `json:"16x16"`
|
||||||
|
Three2X32 string `json:"32x32"`
|
||||||
|
} `json:"avatarUrls"`
|
||||||
|
ProjectCategory struct {
|
||||||
|
Self string `json:"self"`
|
||||||
|
ID string `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Description string `json:"description"`
|
||||||
|
} `json:"projectCategory"`
|
||||||
|
}
|
||||||
|
|
||||||
// Get all projects form jira
|
// Get all projects form jira
|
||||||
// Return array of projects
|
//
|
||||||
|
// JIRA API docs: https://docs.atlassian.com/jira/REST/latest/#api/2/project-getAllProjects
|
||||||
func (s *ProjectService) GetList() (*ProjectList, *http.Response, error) {
|
func (s *ProjectService) GetList() (*ProjectList, *http.Response, error) {
|
||||||
|
|
||||||
apiEndpoint := "rest/api/2/project"
|
apiEndpoint := "rest/api/2/project"
|
||||||
@ -47,3 +148,24 @@ func (s *ProjectService) GetList() (*ProjectList, *http.Response, error) {
|
|||||||
}
|
}
|
||||||
return projectList, resp, nil
|
return projectList, resp, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get returns a full representation of the project for the given issue key.
|
||||||
|
// JIRA will attempt to identify the project by the projectIdOrKey path parameter.
|
||||||
|
// This can be an project id, or an project key.
|
||||||
|
//
|
||||||
|
// JIRA API docs: https://docs.atlassian.com/jira/REST/latest/#api/2/project-getProject
|
||||||
|
func (s *ProjectService) Get(projectID string) (*FullProject, *http.Response, error) {
|
||||||
|
apiEndpoint := fmt.Sprintf("/rest/api/2/project/%s", projectID)
|
||||||
|
req, err := s.client.NewRequest("GET", apiEndpoint, nil)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
project := new(FullProject)
|
||||||
|
resp, err := s.client.Do(req, project)
|
||||||
|
if err != nil {
|
||||||
|
return nil, resp, err
|
||||||
|
}
|
||||||
|
return project, resp, nil
|
||||||
|
}
|
||||||
|
56
project_test.go
Normal file
56
project_test.go
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
package jira
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"io/ioutil"
|
||||||
|
"net/http"
|
||||||
|
"testing"
|
||||||
|
)
|
||||||
|
|
||||||
|
func TestProjectGetAll(t *testing.T) {
|
||||||
|
setup()
|
||||||
|
defer teardown()
|
||||||
|
testApiEdpoint := "/rest/api/2/project"
|
||||||
|
|
||||||
|
raw, err := ioutil.ReadFile("./json_mocks/all_projects.json")
|
||||||
|
if err != nil {
|
||||||
|
t.Error(err.Error())
|
||||||
|
}
|
||||||
|
testMux.HandleFunc(testApiEdpoint, func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
testMethod(t, r, "GET")
|
||||||
|
testRequestURL(t, r, testApiEdpoint)
|
||||||
|
fmt.Fprint(w, string(raw))
|
||||||
|
})
|
||||||
|
|
||||||
|
projects, _, err := testClient.Project.GetList()
|
||||||
|
if projects == nil {
|
||||||
|
t.Error("Expected project list. Project list is nil")
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("Error given: %s", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func TestProjectGet(t *testing.T) {
|
||||||
|
setup()
|
||||||
|
defer teardown()
|
||||||
|
testApiEdpoint := "/rest/api/2/project/12310505"
|
||||||
|
|
||||||
|
raw, err := ioutil.ReadFile("./json_mocks/project.json")
|
||||||
|
if err != nil {
|
||||||
|
t.Error(err.Error())
|
||||||
|
}
|
||||||
|
testMux.HandleFunc(testApiEdpoint, func(w http.ResponseWriter, r *http.Request) {
|
||||||
|
testMethod(t, r, "GET")
|
||||||
|
testRequestURL(t, r, testApiEdpoint)
|
||||||
|
fmt.Fprint(w, string(raw))
|
||||||
|
})
|
||||||
|
|
||||||
|
projects, _, err := testClient.Project.Get("12310505")
|
||||||
|
if projects == nil {
|
||||||
|
t.Error("Expected project list. Project list is nil")
|
||||||
|
}
|
||||||
|
if err != nil {
|
||||||
|
t.Errorf("Error given: %s", err)
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user