Skip to content
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

Added call to get BuildTypes #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions build.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,23 @@ package teamcity

import "fmt"

// BuildType represents a Teamcity Build Type
type BuildType struct {
ID string
Name string
Description string
ProjectName string
ProjectID string
HREF string
WebURL string
}

// Build represents a TeamCity build, along with its metadata.
type Build struct {
ID int64
BuildTypeID string
BuildType struct {
ID string
Name string
Description string
ProjectName string
ProjectID string
HREF string
WebURL string
}
Triggered struct {
BuildType BuildType
Triggered struct {
Type string
Date JSONTime
User struct {
Expand Down
17 changes: 17 additions & 0 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,23 @@ func (c *Client) QueueBuild(buildTypeID string, branchName string, properties ma
return build, nil
}

func (c *Client) GetBuildTypes() ([]*BuildType, error) {
path := "/httpAuth/app/rest/buildTypes"

respStruct := struct {
Count int
BuildType []*BuildType
}{}
retries := 8
err := withRetry(retries, func() error {
return c.doRequest("GET", path, nil, &respStruct)
})
if err != nil {
return nil, err
}
return respStruct.BuildType, nil
}

func (c *Client) SearchBuild(locator string) ([]*Build, error) {
path := fmt.Sprintf("/httpAuth/app/rest/builds/?locator=%s&fields=count,build(*,tags(tag),triggered(*),properties(property),problemOccurrences(*,problemOccurrence(*)),testOccurrences(*,testOccurrence(*)),changes(*,change(*)))", locator)

Expand Down