Skip to content

Commit

Permalink
Slight version changes for 0.4.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben Selby authored and benmatselby committed May 25, 2021
1 parent 571c10a commit 3490c03
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 10 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 0.4.0

- Bumped some of the API versions used.
- Introduced the "Person" structure for fields like `CreatedBy` and `AssignedTo`.

## 0.3.0

- Bumped some of the API versions used.
Expand Down
13 changes: 9 additions & 4 deletions azuredevops/work_items.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ type WorkItem struct {
Fields WorkItemFields `json:"fields"`
}

// Person represents the object coming back from the API.
type Person struct {
DisplayName string `json:"displayName"`
}

// WorkItemFields describes all the fields for a given work item
type WorkItemFields struct {
ID int `json:"System.Id"`
Expand All @@ -48,8 +53,8 @@ type WorkItemFields struct {
Type string `json:"System.WorkItemType"`
Points float64 `json:"Microsoft.VSTS.Scheduling.StoryPoints"`
BoardColumn string `json:"System.BoardColumn"`
CreatedBy string `json:"System.CreatedBy"`
AssignedTo string `json:"System.AssignedTo"`
CreatedBy Person `json:"System.CreatedBy"`
AssignedTo Person `json:"System.AssignedTo"`
Tags string `json:"System.Tags"`
TagList []string
}
Expand Down Expand Up @@ -79,7 +84,7 @@ func (s *WorkItemsService) GetForIteration(team string, iteration Iteration) ([]
"/_apis/wit/workitems?ids=%s&fields=%s&api-version=%s",
strings.Join(workIds, ","),
strings.Join(fields, ","),
"4.1-preview",
"6.1-preview.3",
)

request, err := s.client.NewRequest("GET", URL, nil)
Expand All @@ -104,7 +109,7 @@ func (s *WorkItemsService) GetIdsForIteration(team string, iteration Iteration)
"/%s/_apis/work/teamsettings/iterations/%s/workitems?api-version=%s",
url.PathEscape(team),
iteration.ID,
"4.1-preview",
"6.1-preview.1",
)

request, err := s.client.NewRequest("GET", URL, nil)
Expand Down
60 changes: 54 additions & 6 deletions azuredevops/work_items_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,19 @@ const (
"System.State": "New",
"System.Reason": "New backlog item",
"System.CreatedDate": "2014-12-29T20:49:20.77Z",
"System.CreatedBy": "Jamal Hartnett ",
"System.CreatedBy": {
"displayName": "Jamal Hartnett",
"url": "https://vssps.dev.azure.com/fabrikam/_apis/Identities/d291b0c4-a05c-4ea6-8df1-4b41d5f39eff",
"_links": {
"avatar": {
"href": "https://dev.azure.com/mseng/_apis/GraphProfile/MemberAvatars/aad.YTkzODFkODYtNTYxYS03ZDdiLWJjM2QtZDUzMjllMjM5OTAz"
}
},
"id": "d291b0c4-a05c-4ea6-8df1-4b41d5f39eff",
"uniqueName": "[email protected]",
"imageUrl": "https://dev.azure.com/fabrikam/_api/_common/identityImage?id=d291b0c4-a05c-4ea6-8df1-4b41d5f39eff",
"descriptor": "aad.YTkzODFkODYtNTYxYS03ZDdiLWJjM2QtZDUzMjllMjM5OTAz"
},
"System.ChangedDate": "2014-12-29T20:49:20.77Z",
"System.ChangedBy": "Jamal Hartnett ",
"System.Title": "Customer can sign in using their Microsoft Account",
Expand All @@ -46,9 +58,33 @@ const (
"System.WorkItemType": "Task",
"System.State": "To Do",
"System.Reason": "New task",
"System.AssignedTo": "Johnnie McLeod ",
"System.AssignedTo": {
"displayName": "Jamal Hartnett",
"url": "https://vssps.dev.azure.com/fabrikam/_apis/Identities/d291b0c4-a05c-4ea6-8df1-4b41d5f39eff",
"_links": {
"avatar": {
"href": "https://dev.azure.com/mseng/_apis/GraphProfile/MemberAvatars/aad.YTkzODFkODYtNTYxYS03ZDdiLWJjM2QtZDUzMjllMjM5OTAz"
}
},
"id": "d291b0c4-a05c-4ea6-8df1-4b41d5f39eff",
"uniqueName": "[email protected]",
"imageUrl": "https://dev.azure.com/fabrikam/_api/_common/identityImage?id=d291b0c4-a05c-4ea6-8df1-4b41d5f39eff",
"descriptor": "aad.YTkzODFkODYtNTYxYS03ZDdiLWJjM2QtZDUzMjllMjM5OTAz"
},
"System.CreatedDate": "2014-12-29T20:49:21.617Z",
"System.CreatedBy": "Jamal Hartnett ",
"System.CreatedBy": {
"displayName": "Jamal Hartnett",
"url": "https://vssps.dev.azure.com/fabrikam/_apis/Identities/d291b0c4-a05c-4ea6-8df1-4b41d5f39eff",
"_links": {
"avatar": {
"href": "https://dev.azure.com/mseng/_apis/GraphProfile/MemberAvatars/aad.YTkzODFkODYtNTYxYS03ZDdiLWJjM2QtZDUzMjllMjM5OTAz"
}
},
"id": "d291b0c4-a05c-4ea6-8df1-4b41d5f39eff",
"uniqueName": "[email protected]",
"imageUrl": "https://dev.azure.com/fabrikam/_api/_common/identityImage?id=d291b0c4-a05c-4ea6-8df1-4b41d5f39eff",
"descriptor": "aad.YTkzODFkODYtNTYxYS03ZDdiLWJjM2QtZDUzMjllMjM5OTAz"
},
"System.ChangedDate": "2014-12-29T20:49:28.74Z",
"System.ChangedBy": "Jamal Hartnett ",
"System.Title": "JavaScript implementation for Microsoft Account",
Expand All @@ -69,7 +105,19 @@ const (
"System.State": "To Do",
"System.Reason": "New task",
"System.CreatedDate": "2014-12-29T20:49:22.103Z",
"System.CreatedBy": "Jamal Hartnett ",
"System.CreatedBy": {
"displayName": "Jamal Hartnett",
"url": "https://vssps.dev.azure.com/fabrikam/_apis/Identities/d291b0c4-a05c-4ea6-8df1-4b41d5f39eff",
"_links": {
"avatar": {
"href": "https://dev.azure.com/mseng/_apis/GraphProfile/MemberAvatars/aad.YTkzODFkODYtNTYxYS03ZDdiLWJjM2QtZDUzMjllMjM5OTAz"
}
},
"id": "d291b0c4-a05c-4ea6-8df1-4b41d5f39eff",
"uniqueName": "[email protected]",
"imageUrl": "https://dev.azure.com/fabrikam/_api/_common/identityImage?id=d291b0c4-a05c-4ea6-8df1-4b41d5f39eff",
"descriptor": "aad.YTkzODFkODYtNTYxYS03ZDdiLWJjM2QtZDUzMjllMjM5OTAz"
},
"System.ChangedDate": "2014-12-29T20:49:22.103Z",
"System.ChangedBy": "Jamal Hartnett ",
"System.Title": "Unit Testing for MSA login",
Expand Down Expand Up @@ -134,9 +182,9 @@ func TestWorkItems_GetForIteration(t *testing.T) {
{
name: "we get ids and we get iterations",
idsBaseURL: getIdsURL,
actualIdsURL: "/AZURE_DEVOPS_Project/AZURE_DEVOPS_TEAM/_apis/work/teamsettings/iterations/1/workitems?api-version=4.1-preview",
actualIdsURL: "/AZURE_DEVOPS_Project/AZURE_DEVOPS_TEAM/_apis/work/teamsettings/iterations/1/workitems?api-version=6.1-preview.1",
getBaseURL: getURL,
actualGetURL: "/AZURE_DEVOPS_Project/_apis/wit/workitems?ids=1,3&fields=System.Id,System.Title,System.State,System.WorkItemType,Microsoft.VSTS.Scheduling.StoryPoints,System.BoardColumn,System.CreatedBy,System.AssignedTo,System.Tags&api-version=4.1-preview",
actualGetURL: "/AZURE_DEVOPS_Project/_apis/wit/workitems?ids=1,3&fields=System.Id,System.Title,System.State,System.WorkItemType,Microsoft.VSTS.Scheduling.StoryPoints,System.BoardColumn,System.CreatedBy,System.AssignedTo,System.Tags&api-version=6.1-preview.3",
idsResponse: getIdsResponse,
getResponse: getResponse,
expectedWorkItems: 3,
Expand Down

0 comments on commit 3490c03

Please sign in to comment.