Documentation
¶
Index ¶
- Constants
- Variables
- func FormatTeamCityTime(t time.Time) string
- func ParseTeamCityTime(s string) (time.Time, error)
- func ParseUserDate(input string) (string, error)
- func ToAPIFields(fields []string) string
- func ToAPIFieldsEncoded(fields []string) string
- type APIError
- type APIErrorResponse
- type Agent
- type AgentList
- type AgentRef
- type AgentsOptions
- type ApprovalInfo
- type Artifact
- type Artifacts
- type Build
- type BuildComment
- type BuildList
- type BuildQueue
- type BuildStep
- type BuildType
- type BuildTypeList
- type BuildTypeRef
- type BuildTypesOptions
- type BuildsOptions
- type Change
- type ChangeList
- type Client
- func (c *Client) AddBuildTags(buildID string, tags []string) error
- func (c *Client) ApproveQueuedBuild(buildID string) error
- func (c *Client) AuthorizeAgent(id int, authorized bool) error
- func (c *Client) BuildTypeExists(id string) bool
- func (c *Client) CancelBuild(buildID string, comment string) error
- func (c *Client) CheckVersion() error
- func (c *Client) CreateAPIToken(name string) (*Token, error)
- func (c *Client) CreateBuildStep(buildTypeID string, step BuildStep) error
- func (c *Client) CreateBuildType(projectID string, req CreateBuildTypeRequest) (*BuildType, error)
- func (c *Client) CreateProject(req CreateProjectRequest) (*Project, error)
- func (c *Client) CreateSecureToken(projectID, value string) (string, error)
- func (c *Client) CreateUser(req CreateUserRequest) (*User, error)
- func (c *Client) DeleteAPIToken(name string) error
- func (c *Client) DeleteBuildComment(buildID string) error
- func (c *Client) DeleteBuildTypeParameter(buildTypeID, name string) error
- func (c *Client) DeleteProjectParameter(projectID, name string) error
- func (c *Client) DownloadArtifact(buildID, artifactPath string) ([]byte, error)
- func (c *Client) GetAgents(opts AgentsOptions) (*AgentList, error)
- func (c *Client) GetArtifacts(buildID string) (*Artifacts, error)
- func (c *Client) GetBuild(ref string) (*Build, error)
- func (c *Client) GetBuildChanges(buildID string) (*ChangeList, error)
- func (c *Client) GetBuildComment(buildID string) (string, error)
- func (c *Client) GetBuildLog(buildID string) (string, error)
- func (c *Client) GetBuildQueue(opts QueueOptions) (*BuildQueue, error)
- func (c *Client) GetBuildTags(buildID string) (*TagList, error)
- func (c *Client) GetBuildTests(buildID string, failedOnly bool, limit int) (*TestOccurrences, error)
- func (c *Client) GetBuildType(id string) (*BuildType, error)
- func (c *Client) GetBuildTypeParameter(buildTypeID, name string) (*Parameter, error)
- func (c *Client) GetBuildTypeParameters(buildTypeID string) (*ParameterList, error)
- func (c *Client) GetBuildTypes(opts BuildTypesOptions) (*BuildTypeList, error)
- func (c *Client) GetBuilds(opts BuildsOptions) (*BuildList, error)
- func (c *Client) GetCurrentUser() (*User, error)
- func (c *Client) GetParameterValue(path string) (string, error)
- func (c *Client) GetProject(id string) (*Project, error)
- func (c *Client) GetProjectParameter(projectID, name string) (*Parameter, error)
- func (c *Client) GetProjectParameters(projectID string) (*ParameterList, error)
- func (c *Client) GetProjects(opts ProjectsOptions) (*ProjectList, error)
- func (c *Client) GetQueuedBuildApprovalInfo(buildID string) (*ApprovalInfo, error)
- func (c *Client) GetSecureValue(projectID, token string) (string, error)
- func (c *Client) GetServer() (*Server, error)
- func (c *Client) GetUser(username string) (*User, error)
- func (c *Client) MoveQueuedBuildToTop(buildID string) error
- func (c *Client) PinBuild(buildID string, comment string) error
- func (c *Client) ProjectExists(id string) bool
- func (c *Client) RawRequest(method, path string, body io.Reader, headers map[string]string) (*RawResponse, error)
- func (c *Client) RemoveBuildTag(buildID string, tag string) error
- func (c *Client) RemoveFromQueue(id string) error
- func (c *Client) ResolveBuildID(ref string) (string, error)
- func (c *Client) RunBuild(buildTypeID string, opts RunBuildOptions) (*Build, error)
- func (c *Client) ServerVersion() (*Server, error)
- func (c *Client) SetBuildComment(buildID string, comment string) error
- func (c *Client) SetBuildTypeParameter(buildTypeID, name, value string, secure bool) error
- func (c *Client) SetBuildTypePaused(id string, paused bool) error
- func (c *Client) SetBuildTypeSetting(buildTypeID, setting, value string) error
- func (c *Client) SetProjectParameter(projectID, name, value string, secure bool) error
- func (c *Client) SetQueuedBuildPosition(buildID string, position int) error
- func (c *Client) SupportsFeature(feature string) bool
- func (c *Client) UnpinBuild(buildID string) error
- func (c *Client) UserExists(username string) bool
- type ClientInterface
- type ClientOption
- type Content
- type CreateBuildTypeRequest
- type CreateProjectRequest
- type CreateUserRequest
- type FieldSpec
- type FileChange
- type Files
- type Locator
- func (l *Locator) Add(key, value string) *Locator
- func (l *Locator) AddInt(key string, value int) *Locator
- func (l *Locator) AddIntDefault(key string, value, defaultVal int) *Locator
- func (l *Locator) AddUpper(key, value string) *Locator
- func (l *Locator) Encode() string
- func (l *Locator) IsEmpty() bool
- func (l *Locator) String() string
- type Parameter
- type ParameterList
- type ParameterType
- type Pool
- type Project
- type ProjectList
- type ProjectsOptions
- type Property
- type PropertyList
- type QueueOptions
- type QueuedBuild
- type RawResponse
- type RetryConfig
- type Role
- type RoleList
- type RunBuildOptions
- type Server
- type Tag
- type TagList
- type TestOccurrence
- type TestOccurrences
- type Token
- type TriggerBuildRequest
- type Triggered
- type TriggeringOptions
- type User
Constants ¶
const ( MinMajorVersion = 2020 MinMinorVersion = 1 )
Minimum supported TeamCity version
Variables ¶
var ( // ReadRetry is the default for idempotent read operations (GET). // Retries on network errors and 5xx responses. ReadRetry = RetryConfig{MaxRetries: 3, Interval: 200 * time.Millisecond} // NoRetry disables retries. Use for non-idempotent operations (POST to queue, etc.). NoRetry = RetryConfig{MaxRetries: 0} // LongRetry is for operations that may need more time to succeed // (e.g., waiting for resources to propagate). LongRetry = RetryConfig{MaxRetries: 3, Interval: 1 * time.Second} )
Predefined retry configurations for different operation types.
var AgentFields = FieldSpec{ Available: []string{"id", "name", "typeId", "connected", "enabled", "authorized", "href", "webUrl", "pool.id", "pool.name"}, Default: []string{"id", "name", "connected", "enabled", "authorized", "href", "webUrl", "pool.id", "pool.name"}, }
var BuildFields = FieldSpec{ Available: []string{ "id", "number", "status", "state", "href", "webUrl", "branchName", "defaultBranch", "buildTypeId", "statusText", "queuedDate", "startDate", "finishDate", "percentageComplete", "pinned", "tags.tag.name", "buildType.id", "buildType.name", "buildType.projectName", "buildType.projectId", "buildType.href", "buildType.webUrl", "triggered.type", "triggered.date", "triggered.user.name", "triggered.user.username", "agent.id", "agent.name", "agent.href", "agent.webUrl", }, Default: []string{ "id", "number", "status", "state", "branchName", "buildTypeId", "buildType.id", "buildType.name", "buildType.projectName", "triggered.type", "triggered.user.name", "triggered.user.username", "startDate", "finishDate", "queuedDate", "agent.name", }, }
BuildFields field specifications
var BuildTypeFields = FieldSpec{ Available: []string{"id", "name", "projectName", "projectId", "href", "webUrl", "paused"}, Default: []string{"id", "name", "projectName", "projectId", "href", "webUrl", "paused"}, }
var ProjectFields = FieldSpec{ Available: []string{"id", "name", "description", "parentProjectId", "href", "webUrl"}, Default: []string{"id", "name", "description", "parentProjectId", "href", "webUrl"}, }
var QueuedBuildFields = FieldSpec{ Available: []string{ "id", "buildTypeId", "state", "branchName", "href", "webUrl", "queuedDate", "buildType.id", "buildType.name", "buildType.projectName", "triggered.type", "triggered.date", "triggered.user.name", "triggered.user.username", }, Default: []string{ "id", "buildTypeId", "state", "branchName", "href", "webUrl", "queuedDate", "buildType.id", "buildType.name", "buildType.projectName", "triggered.type", "triggered.user.name", "triggered.user.username", }, }
Functions ¶
func FormatTeamCityTime ¶
FormatTeamCityTime formats time to TeamCity's date format.
func ParseTeamCityTime ¶
ParseTeamCityTime parses TeamCity's time format (20250710T080607+0000)
func ParseUserDate ¶
ParseUserDate converts user input to TeamCity date format. Supports: "24h" (relative), "2026-01-21" (absolute), or TeamCity format.
func ToAPIFields ¶
ToAPIFields converts dot-notation fields to TeamCity API fields parameter. Example: ["id", "buildType.name", "buildType.projectId"] -> "id,buildType(name,projectId)"
func ToAPIFieldsEncoded ¶
ToAPIFieldsEncoded returns URL-encoded TeamCity API fields parameter
Types ¶
type APIError ¶
type APIError struct {
Message string `json:"message"`
}
APIError represents an error from TeamCity's REST API
type APIErrorResponse ¶
type APIErrorResponse struct {
Errors []APIError `json:"errors"`
}
APIErrorResponse represents TeamCity's error response format
type Agent ¶
type Agent struct {
ID int `json:"id,omitempty"`
Name string `json:"name,omitempty"`
TypeID int `json:"typeId,omitempty"`
Connected bool `json:"connected,omitempty"`
Enabled bool `json:"enabled,omitempty"`
Authorized bool `json:"authorized,omitempty"`
Href string `json:"href,omitempty"`
WebURL string `json:"webUrl,omitempty"`
Pool *Pool `json:"pool,omitempty"`
Build *Build `json:"build,omitempty"`
}
Agent represents a build agent
type AgentList ¶
type AgentList struct {
Count int `json:"count"`
Href string `json:"href"`
NextHref string `json:"nextHref,omitempty"`
Agents []Agent `json:"agent"`
}
AgentList represents a list of agents
type AgentsOptions ¶
type AgentsOptions struct {
Authorized bool // Filter by authorization status
Connected bool // Filter by connection status
Enabled bool // Filter by enabled status
Pool string // Filter by pool name
Limit int
}
AgentsOptions represents options for listing agents
type ApprovalInfo ¶
type ApprovalInfo struct {
Status string `json:"status"`
ConfigurationValid bool `json:"configurationValid"`
CanBeApprovedByCurrentUser bool `json:"canBeApprovedByCurrentUser"`
}
ApprovalInfo represents approval information for a queued build
type Artifact ¶
type Artifact struct {
Name string `json:"name"`
Size int64 `json:"size,omitempty"`
ModTime string `json:"modificationTime,omitempty"`
Href string `json:"href,omitempty"`
Children *Artifacts `json:"children,omitempty"`
Content *Content `json:"content,omitempty"`
}
Artifact represents a build artifact
type Build ¶
type Build struct {
ID int `json:"id"`
BuildTypeID string `json:"buildTypeId,omitempty"`
Number string `json:"number,omitempty"`
Status string `json:"status,omitempty"`
State string `json:"state,omitempty"`
BranchName string `json:"branchName,omitempty"`
DefaultBranch bool `json:"defaultBranch,omitempty"`
Href string `json:"href,omitempty"`
WebURL string `json:"webUrl,omitempty"`
StatusText string `json:"statusText,omitempty"`
QueuedDate string `json:"queuedDate,omitempty"`
StartDate string `json:"startDate,omitempty"`
FinishDate string `json:"finishDate,omitempty"`
BuildType *BuildType `json:"buildType,omitempty"`
Triggered *Triggered `json:"triggered,omitempty"`
Agent *Agent `json:"agent,omitempty"`
PercentageComplete int `json:"percentageComplete,omitempty"`
Pinned bool `json:"pinned,omitempty"`
Tags *TagList `json:"tags,omitempty"`
}
Build represents a TeamCity build
type BuildComment ¶
type BuildComment struct {
Text string `json:"text"`
}
BuildComment represents a comment on a build
type BuildList ¶
type BuildList struct {
Count int `json:"count"`
Href string `json:"href"`
NextHref string `json:"nextHref,omitempty"`
Builds []Build `json:"build"`
}
BuildList represents a list of builds
type BuildQueue ¶
type BuildQueue struct {
Count int `json:"count"`
Href string `json:"href"`
Builds []QueuedBuild `json:"build"`
}
BuildQueue represents the build queue
type BuildStep ¶
type BuildStep struct {
ID string `json:"id,omitempty"`
Name string `json:"name"`
Type string `json:"type"`
Properties PropertyList `json:"properties,omitempty"`
}
BuildStep represents a build step configuration
type BuildType ¶
type BuildType struct {
ID string `json:"id"`
Name string `json:"name,omitempty"`
ProjectName string `json:"projectName,omitempty"`
ProjectID string `json:"projectId,omitempty"`
Href string `json:"href,omitempty"`
WebURL string `json:"webUrl,omitempty"`
Paused bool `json:"paused,omitempty"`
Project Project `json:"project,omitempty"`
}
BuildType represents a build configuration
type BuildTypeList ¶
BuildTypeList represents a list of build configurations
type BuildTypeRef ¶
type BuildTypeRef struct {
ID string `json:"id"`
}
BuildTypeRef is a reference to a build type
type BuildTypesOptions ¶
BuildTypesOptions represents options for listing build configurations
type BuildsOptions ¶
type BuildsOptions struct {
BuildTypeID string
Branch string
Status string
State string
User string
Project string
Number string
Limit int
SinceDate string
UntilDate string
Fields []string
}
BuildsOptions represents options for listing builds
type Change ¶
type Change struct {
ID int `json:"id,omitempty"`
Version string `json:"version,omitempty"` // commit SHA
Username string `json:"username,omitempty"`
Date string `json:"date,omitempty"`
Comment string `json:"comment,omitempty"`
WebURL string `json:"webUrl,omitempty"`
Files *Files `json:"files,omitempty"`
}
type ChangeList ¶
type Client ¶
type Client struct {
BaseURL string
Token string
APIVersion string // Optional: pin to a specific API version (e.g., "2020.1")
HTTPClient *http.Client
// contains filtered or unexported fields
}
Client represents a TeamCity API client
func NewClient ¶
func NewClient(baseURL, token string, opts ...ClientOption) *Client
NewClient creates a new TeamCity API client with Bearer token authentication
func NewClientWithBasicAuth ¶
func NewClientWithBasicAuth(baseURL, username, password string, opts ...ClientOption) *Client
NewClientWithBasicAuth creates a new TeamCity API client with Basic authentication. Use empty username with superuser token, or username/password for regular users.
func (*Client) AddBuildTags ¶
AddBuildTags adds tags to a build (accepts ID or #number)
func (*Client) ApproveQueuedBuild ¶
ApproveQueuedBuild approves a queued build that requires approval
func (*Client) AuthorizeAgent ¶
AuthorizeAgent sets the authorized status of an agent
func (*Client) BuildTypeExists ¶
BuildTypeExists checks if a build configuration exists
func (*Client) CancelBuild ¶
CancelBuild cancels a running or queued build (accepts ID or #number)
func (*Client) CheckVersion ¶
CheckVersion verifies the server meets minimum version requirements
func (*Client) CreateAPIToken ¶
CreateAPIToken creates an API token for the current user
func (*Client) CreateBuildStep ¶
CreateBuildStep adds a build step to a build configuration
func (*Client) CreateBuildType ¶
func (c *Client) CreateBuildType(projectID string, req CreateBuildTypeRequest) (*BuildType, error)
CreateBuildType creates a new build configuration in a project
func (*Client) CreateProject ¶
func (c *Client) CreateProject(req CreateProjectRequest) (*Project, error)
CreateProject creates a new project
func (*Client) CreateSecureToken ¶
CreateSecureToken creates a new secure token for the given value in a project. Returns the scrambled token that can be used in configuration files as credentialsJSON:<token>. Requires EDIT_PROJECT permission.
func (*Client) CreateUser ¶
func (c *Client) CreateUser(req CreateUserRequest) (*User, error)
CreateUser creates a new user
func (*Client) DeleteAPIToken ¶
DeleteAPIToken deletes an API token for the current user
func (*Client) DeleteBuildComment ¶
DeleteBuildComment removes the comment from a build (accepts ID or #number)
func (*Client) DeleteBuildTypeParameter ¶
DeleteBuildTypeParameter deletes a parameter from a build configuration
func (*Client) DeleteProjectParameter ¶
DeleteProjectParameter deletes a parameter from a project
func (*Client) DownloadArtifact ¶
DownloadArtifact downloads an artifact and returns its content (accepts ID or #number)
func (*Client) GetAgents ¶
func (c *Client) GetAgents(opts AgentsOptions) (*AgentList, error)
GetAgents returns a list of agents
func (*Client) GetArtifacts ¶
GetArtifacts returns the artifacts for a build (accepts ID or #number)
func (*Client) GetBuildChanges ¶
func (c *Client) GetBuildChanges(buildID string) (*ChangeList, error)
func (*Client) GetBuildComment ¶
GetBuildComment returns the comment for a build (accepts ID or #number)
func (*Client) GetBuildLog ¶
GetBuildLog returns the build log (accepts ID or #number)
func (*Client) GetBuildQueue ¶
func (c *Client) GetBuildQueue(opts QueueOptions) (*BuildQueue, error)
GetBuildQueue returns the build queue
func (*Client) GetBuildTags ¶
GetBuildTags returns the tags for a build (accepts ID or #number)
func (*Client) GetBuildTests ¶
func (*Client) GetBuildType ¶
GetBuildType returns a single build configuration by ID
func (*Client) GetBuildTypeParameter ¶
GetBuildTypeParameter returns a specific parameter for a build configuration
func (*Client) GetBuildTypeParameters ¶
func (c *Client) GetBuildTypeParameters(buildTypeID string) (*ParameterList, error)
GetBuildTypeParameters returns parameters for a build configuration
func (*Client) GetBuildTypes ¶
func (c *Client) GetBuildTypes(opts BuildTypesOptions) (*BuildTypeList, error)
GetBuildTypes returns a list of build configurations
func (*Client) GetBuilds ¶
func (c *Client) GetBuilds(opts BuildsOptions) (*BuildList, error)
GetBuilds returns a list of builds
func (*Client) GetCurrentUser ¶
GetCurrentUser returns the authenticated user
func (*Client) GetParameterValue ¶
GetParameterValue returns just the raw value of a parameter
func (*Client) GetProject ¶
GetProject returns a single project by ID
func (*Client) GetProjectParameter ¶
GetProjectParameter returns a specific parameter for a project
func (*Client) GetProjectParameters ¶
func (c *Client) GetProjectParameters(projectID string) (*ParameterList, error)
GetProjectParameters returns parameters for a project
func (*Client) GetProjects ¶
func (c *Client) GetProjects(opts ProjectsOptions) (*ProjectList, error)
GetProjects returns a list of projects
func (*Client) GetQueuedBuildApprovalInfo ¶
func (c *Client) GetQueuedBuildApprovalInfo(buildID string) (*ApprovalInfo, error)
GetQueuedBuildApprovalInfo returns approval information for a queued build
func (*Client) GetSecureValue ¶
GetSecureValue retrieves the original value for a secure token. Requires CHANGE_SERVER_SETTINGS permission (System Administrator only).
func (*Client) MoveQueuedBuildToTop ¶
MoveQueuedBuildToTop moves a queued build to the top of the queue
func (*Client) PinBuild ¶
PinBuild pins a build to prevent it from being cleaned up (accepts ID or #number)
func (*Client) ProjectExists ¶
ProjectExists checks if a project exists
func (*Client) RawRequest ¶
func (c *Client) RawRequest(method, path string, body io.Reader, headers map[string]string) (*RawResponse, error)
RawRequest performs a raw HTTP request and returns the response without parsing
func (*Client) RemoveBuildTag ¶
RemoveBuildTag removes a specific tag from a build (accepts ID or #number)
func (*Client) RemoveFromQueue ¶
RemoveFromQueue removes a build from the queue
func (*Client) ResolveBuildID ¶
ResolveBuildID resolves a build reference to an ID. If ref starts with #, it's treated as a build number and looked up. Otherwise it's used as-is (assumed to be an ID).
func (*Client) RunBuild ¶
func (c *Client) RunBuild(buildTypeID string, opts RunBuildOptions) (*Build, error)
RunBuild runs a new build with full options
func (*Client) ServerVersion ¶
ServerVersion returns cached server version info
func (*Client) SetBuildComment ¶
SetBuildComment sets or updates the comment on a build (accepts ID or #number)
func (*Client) SetBuildTypeParameter ¶
SetBuildTypeParameter sets a parameter for a build configuration
func (*Client) SetBuildTypePaused ¶
SetBuildTypePaused sets the paused state of a build configuration
func (*Client) SetBuildTypeSetting ¶
SetBuildTypeSetting sets a build configuration setting
func (*Client) SetProjectParameter ¶
SetProjectParameter sets a parameter for a project
func (*Client) SetQueuedBuildPosition ¶
SetQueuedBuildPosition moves a queued build to a specific position in the queue
func (*Client) SupportsFeature ¶
SupportsFeature checks if the server supports a specific feature
func (*Client) UnpinBuild ¶
UnpinBuild removes the pin from a build (accepts ID or #number)
func (*Client) UserExists ¶
UserExists checks if a user exists
type ClientInterface ¶
type ClientInterface interface {
// Server
GetServer() (*Server, error)
ServerVersion() (*Server, error)
CheckVersion() error
SupportsFeature(feature string) bool
// Users
GetCurrentUser() (*User, error)
GetUser(username string) (*User, error)
UserExists(username string) bool
CreateUser(req CreateUserRequest) (*User, error)
CreateAPIToken(name string) (*Token, error)
DeleteAPIToken(name string) error
// Projects
GetProjects(opts ProjectsOptions) (*ProjectList, error)
GetProject(id string) (*Project, error)
CreateProject(req CreateProjectRequest) (*Project, error)
ProjectExists(id string) bool
CreateSecureToken(projectID, value string) (string, error)
GetSecureValue(projectID, token string) (string, error)
// Build Types (Jobs)
GetBuildTypes(opts BuildTypesOptions) (*BuildTypeList, error)
GetBuildType(id string) (*BuildType, error)
SetBuildTypePaused(id string, paused bool) error
CreateBuildType(projectID string, req CreateBuildTypeRequest) (*BuildType, error)
BuildTypeExists(id string) bool
CreateBuildStep(buildTypeID string, step BuildStep) error
SetBuildTypeSetting(buildTypeID, setting, value string) error
// Builds (Runs)
GetBuilds(opts BuildsOptions) (*BuildList, error)
GetBuild(ref string) (*Build, error)
ResolveBuildID(ref string) (string, error)
RunBuild(buildTypeID string, opts RunBuildOptions) (*Build, error)
CancelBuild(buildID string, comment string) error
GetBuildLog(buildID string) (string, error)
PinBuild(buildID string, comment string) error
UnpinBuild(buildID string) error
AddBuildTags(buildID string, tags []string) error
GetBuildTags(buildID string) (*TagList, error)
RemoveBuildTag(buildID string, tag string) error
SetBuildComment(buildID string, comment string) error
GetBuildComment(buildID string) (string, error)
DeleteBuildComment(buildID string) error
GetBuildChanges(buildID string) (*ChangeList, error)
GetBuildTests(buildID string, failedOnly bool, limit int) (*TestOccurrences, error)
// Artifacts
GetArtifacts(buildID string) (*Artifacts, error)
DownloadArtifact(buildID, artifactPath string) ([]byte, error)
// Build Queue
GetBuildQueue(opts QueueOptions) (*BuildQueue, error)
RemoveFromQueue(id string) error
SetQueuedBuildPosition(buildID string, position int) error
MoveQueuedBuildToTop(buildID string) error
ApproveQueuedBuild(buildID string) error
GetQueuedBuildApprovalInfo(buildID string) (*ApprovalInfo, error)
// Parameters
GetProjectParameters(projectID string) (*ParameterList, error)
GetProjectParameter(projectID, name string) (*Parameter, error)
SetProjectParameter(projectID, name, value string, secure bool) error
DeleteProjectParameter(projectID, name string) error
GetBuildTypeParameters(buildTypeID string) (*ParameterList, error)
GetBuildTypeParameter(buildTypeID, name string) (*Parameter, error)
SetBuildTypeParameter(buildTypeID, name, value string, secure bool) error
DeleteBuildTypeParameter(buildTypeID, name string) error
GetParameterValue(path string) (string, error)
// Agents
GetAgents(opts AgentsOptions) (*AgentList, error)
AuthorizeAgent(id int, authorized bool) error
// Raw API access
RawRequest(method, path string, body io.Reader, headers map[string]string) (*RawResponse, error)
}
ClientInterface defines the TeamCity API client interface. Cmd package uses this interface for dependency injection in tests.
type ClientOption ¶
type ClientOption func(*Client)
ClientOption allows configuring the client
func WithAPIVersion ¶
func WithAPIVersion(version string) ClientOption
WithAPIVersion pins the client to a specific API version
func WithTimeout ¶
func WithTimeout(timeout time.Duration) ClientOption
WithTimeout sets a custom HTTP timeout
type Content ¶
type Content struct {
Href string `json:"href"`
}
Content represents artifact content reference
type CreateBuildTypeRequest ¶
CreateBuildTypeRequest represents a request to create a build configuration
type CreateProjectRequest ¶
type CreateProjectRequest struct {
ID string `json:"id,omitempty"`
Name string `json:"name"`
ParentProjectID string `json:"parentProject,omitempty"`
}
CreateProjectRequest represents a request to create a project
type CreateUserRequest ¶
type CreateUserRequest struct {
Username string `json:"username"`
Password string `json:"password"`
Name string `json:"name,omitempty"`
Email string `json:"email,omitempty"`
Roles RoleList `json:"roles,omitempty"`
}
CreateUserRequest represents a request to create a user
type FileChange ¶
type Files ¶
type Files struct {
File []FileChange `json:"file"`
}
type Locator ¶
type Locator struct {
// contains filtered or unexported fields
}
func NewLocator ¶
func NewLocator() *Locator
func (*Locator) AddIntDefault ¶
type Parameter ¶
type Parameter struct {
Name string `json:"name"`
Value string `json:"value"`
Type *ParameterType `json:"type,omitempty"`
}
Parameter represents a TeamCity parameter
type ParameterList ¶
ParameterList represents a list of parameters
type ParameterType ¶
type ParameterType struct {
RawValue string `json:"rawValue,omitempty"`
}
ParameterType represents parameter type info
type Pool ¶
type Pool struct {
ID int `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Href string `json:"href,omitempty"`
}
Pool represents an agent pool
type Project ¶
type Project struct {
ID string `json:"id"`
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
ParentProjectID string `json:"parentProjectId,omitempty"`
Href string `json:"href,omitempty"`
WebURL string `json:"webUrl,omitempty"`
}
Project represents a TeamCity project
type ProjectList ¶
ProjectList represents a list of projects
type ProjectsOptions ¶
ProjectsOptions represents options for listing projects
type PropertyList ¶
type PropertyList struct {
Property []Property `json:"property"`
}
PropertyList represents a list of properties
type QueueOptions ¶
QueueOptions represents options for listing queued builds
type QueuedBuild ¶
type QueuedBuild struct {
ID int `json:"id"`
BuildTypeID string `json:"buildTypeId,omitempty"`
State string `json:"state,omitempty"`
BranchName string `json:"branchName,omitempty"`
Href string `json:"href,omitempty"`
WebURL string `json:"webUrl,omitempty"`
BuildType *BuildType `json:"buildType,omitempty"`
Triggered *Triggered `json:"triggered,omitempty"`
QueuedDate string `json:"queuedDate,omitempty"`
}
QueuedBuild represents a build in the queue
type RawResponse ¶
RawResponse represents the response from a raw API request
type RetryConfig ¶
RetryConfig defines retry behavior for API operations.
type Role ¶
type Role struct {
RoleID string `json:"roleId"`
Scope string `json:"scope"` // "g" for global, "p:ProjectID" for project
}
Role represents a TeamCity role assignment
type RoleList ¶
type RoleList struct {
Role []Role `json:"role"`
}
RoleList represents a list of role assignments
type RunBuildOptions ¶
type RunBuildOptions struct {
Branch string
Params map[string]string // Configuration parameters
SystemProps map[string]string // System properties (system.*)
EnvVars map[string]string // Environment variables (env.*)
Comment string
Personal bool
CleanSources bool
RebuildDependencies bool
QueueAtTop bool
RebuildFailedDependencies bool
AgentID int
Tags []string
}
RunBuildOptions represents options for running a build
type Server ¶
type Server struct {
Version string `json:"version"`
VersionMajor int `json:"versionMajor"`
VersionMinor int `json:"versionMinor"`
BuildNumber string `json:"buildNumber"`
WebURL string `json:"webUrl"`
}
Server represents TeamCity server info
type TestOccurrence ¶
type TestOccurrences ¶
type TestOccurrences struct {
Count int `json:"count"`
Passed int `json:"passed,omitempty"`
Failed int `json:"failed,omitempty"`
Ignored int `json:"ignored,omitempty"`
TestOccurrence []TestOccurrence `json:"testOccurrence"`
}
type TriggerBuildRequest ¶
type TriggerBuildRequest struct {
BuildType BuildTypeRef `json:"buildType"`
BranchName string `json:"branchName,omitempty"`
Properties *PropertyList `json:"properties,omitempty"`
Comment *BuildComment `json:"comment,omitempty"`
Personal bool `json:"personal,omitempty"`
TriggeringOptions *TriggeringOptions `json:"triggeringOptions,omitempty"`
Agent *AgentRef `json:"agent,omitempty"`
Tags *TagList `json:"tags,omitempty"`
}
TriggerBuildRequest represents a request to trigger a build
type Triggered ¶
type Triggered struct {
Type string `json:"type,omitempty"`
Date string `json:"date,omitempty"`
User *User `json:"user,omitempty"`
}
Triggered represents who/what triggered a build
type TriggeringOptions ¶
type TriggeringOptions struct {
CleanSources bool `json:"cleanSources,omitempty"`
RebuildAllDependencies bool `json:"rebuildAllDependencies,omitempty"`
QueueAtTop bool `json:"queueAtTop,omitempty"`
RebuildFailedOrIncomplete bool `json:"rebuildFailedOrIncompleteDependencies,omitempty"`
}
TriggeringOptions represents options for triggering a build