From 30424477a0dc79c3427c03491d3bc305bf1cf78c Mon Sep 17 00:00:00 2001 From: Ali Tavakoli Date: Thu, 29 Aug 2024 10:22:27 -0400 Subject: [PATCH] Include subprojects in Project struct The Projects field, which includes references to all subprojects, was always in the payload returned from TeamCity, but was not returned from the .GetBy(ID|Name) functions due to it not being part of the Project struct. --- teamcity/project.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/teamcity/project.go b/teamcity/project.go index 94209e4..0b8dde1 100644 --- a/teamcity/project.go +++ b/teamcity/project.go @@ -22,6 +22,7 @@ type Project struct { ParentProjectID string `json:"parentProjectId,omitempty" xml:"parentProjectId"` WebURL string `json:"webUrl,omitempty" xml:"webUrl"` BuildTypes BuildTypeReferences `json:"buildTypes,omitempty" xml:"buildTypes"` + Projects ProjectReferences `json:"projects,omitempty" xml:"projects"` } // ProjectReference contains basic information, usually enough to use as a type for relationships. @@ -34,6 +35,15 @@ type ProjectReference struct { WebURL string `json:"webUrl,omitempty" xml:"webUrl"` } +// ProjectReferences represents a collection of *ProjectReference. +type ProjectReferences struct { + // count + Count int32 `json:"count,omitempty" xml:"count"` + + // project + Items []*ProjectReference `json:"project"` +} + // ProjectService has operations for handling projects type ProjectService struct { sling *sling.Sling