Documentation
¶
Index ¶
- Constants
- Variables
- func BuildAuthorizeURL(serverURL, redirectURI, challenge, state string, scopes []string) string
- func DefaultScopes() []string
- func EnvHeaders() map[string]string
- func ErrorFromResponse(resp *http.Response) error
- func ExtractErrorMessage(body []byte) string
- func FormatTeamCityTime(t time.Time) string
- func IsSandboxBlocked(err error) bool
- func ParseTeamCityTime(s string) (time.Time, error)
- func ParseUserDate(input string) (string, error)
- func PermissionEnum(description string) string
- 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 AuthSource
- type Build
- type BuildComment
- type BuildList
- type BuildMessage
- type BuildMessagesOptions
- type BuildMessagesResponse
- type BuildQueue
- type BuildRef
- type BuildStep
- type BuildType
- type BuildTypeList
- type BuildTypeRef
- type BuildTypesOptions
- type BuildsOptions
- type Category
- type Change
- type ChangeList
- type Client
- func (c *Client) AddBuildTags(buildID string, tags []string) error
- func (c *Client) AddProjectToPool(poolID int, projectID 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) CreatePipeline(parentProjectID, name, yaml, vcsRootID string) (*Pipeline, error)
- func (c *Client) CreateProject(req CreateProjectRequest) (*Project, error)
- func (c *Client) CreateProjectFeature(projectID string, feat ProjectFeature) (*ProjectFeature, error)
- func (c *Client) CreateSecureToken(projectID, value string) (string, error)
- func (c *Client) CreateUser(req CreateUserRequest) (*User, error)
- func (c *Client) CreateVcsRoot(root VcsRoot) (*VcsRoot, 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) DeletePipeline(id string) error
- func (c *Client) DeleteProjectFeature(projectID, featureID string) error
- func (c *Client) DeleteProjectParameter(projectID, name string) error
- func (c *Client) DeleteSSHKey(projectID, name string) error
- func (c *Client) DeleteVcsRoot(id string) error
- func (c *Client) DownloadArtifact(ctx context.Context, buildID, artifactPath string) ([]byte, error)
- func (c *Client) DownloadArtifactTo(ctx context.Context, buildID, artifactPath string, w io.Writer) (int64, error)
- func (c *Client) EnableAgent(id int, enabled bool) error
- func (c *Client) ExchangeCodeForToken(ctx context.Context, code, verifier, redirectURI string) (*TokenResponse, error)
- func (c *Client) ExportProjectSettings(projectID, format string, useRelativeIds bool) ([]byte, error)
- func (c *Client) GenerateSSHKey(projectID, name, keyType string) (*SSHKey, error)
- func (c *Client) GetAgent(id int) (*Agent, error)
- func (c *Client) GetAgentBuildTypeCompatibility(agentID int, buildTypeID string, maxScan int) (*Compatibility, error)
- func (c *Client) GetAgentByName(name string) (*Agent, error)
- func (c *Client) GetAgentCompatibleBuildTypes(id int) (*BuildTypeList, error)
- func (c *Client) GetAgentIncompatibleBuildTypes(id int) (*CompatibilityList, error)
- func (c *Client) GetAgentPool(id int) (*Pool, error)
- func (c *Client) GetAgentPools(requestedFields []string) (*PoolList, error)
- func (c *Client) GetAgents(opts AgentsOptions) (*AgentList, error)
- func (c *Client) GetArtifacts(ctx context.Context, buildID string, subpath string) (*Artifacts, error)
- func (c *Client) GetBuild(ctx context.Context, ref string) (*Build, error)
- func (c *Client) GetBuildChanges(ctx context.Context, buildID string) (*ChangeList, error)
- func (c *Client) GetBuildComment(buildID string) (string, error)
- func (c *Client) GetBuildCompatibleAgents(buildID int) (*AgentList, error)
- func (c *Client) GetBuildIncompatibleAgents(buildID int) (*AgentList, error)
- func (c *Client) GetBuildLog(ctx context.Context, buildID string) (string, error)
- func (c *Client) GetBuildMessages(ctx context.Context, buildID string, opts BuildMessagesOptions) (*BuildMessagesResponse, error)
- func (c *Client) GetBuildPipelineRun(buildID string) (*PipelineRun, error)
- func (c *Client) GetBuildProblems(buildID string) (*ProblemOccurrences, error)
- func (c *Client) GetBuildQueue(opts QueueOptions) (*BuildQueue, error)
- func (c *Client) GetBuildResultingProperties(buildID string) (*ParameterList, error)
- func (c *Client) GetBuildSnapshotDependencies(buildID string) (*BuildList, error)
- func (c *Client) GetBuildTags(buildID string) (*TagList, error)
- func (c *Client) GetBuildTestSummary(buildID string) (*TestOccurrences, error)
- func (c *Client) GetBuildTests(ctx context.Context, 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) GetBuildUsedByOtherBuilds(id string) (bool, error)
- func (c *Client) GetBuilds(ctx context.Context, opts BuildsOptions) (*BuildList, error)
- func (c *Client) GetCloudImage(locator string) (*CloudImage, error)
- func (c *Client) GetCloudImages(opts CloudImagesOptions) (*CloudImageList, error)
- func (c *Client) GetCloudInstance(locator string) (*CloudInstance, error)
- func (c *Client) GetCloudInstances(opts CloudInstancesOptions) (*CloudInstanceList, error)
- func (c *Client) GetCloudProfile(locator string) (*CloudProfile, error)
- func (c *Client) GetCloudProfiles(opts CloudProfilesOptions) (*CloudProfileList, error)
- func (c *Client) GetCurrentUser() (*User, error)
- func (c *Client) GetDependentBuildTypes(buildTypeID string) (*BuildTypeList, error)
- func (c *Client) GetParameterValue(path string) (string, error)
- func (c *Client) GetPipeline(id string) (*Pipeline, error)
- func (c *Client) GetPipelineSchema() ([]byte, error)
- func (c *Client) GetPipelineYAML(id string) (string, error)
- func (c *Client) GetPipelines(opts PipelinesOptions) (*PipelineList, error)
- func (c *Client) GetProject(id string) (*Project, error)
- func (c *Client) GetProjectConnections(projectID string) (*ProjectFeatureList, 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) GetSSHKeys(projectID string) (*SSHKeyList, error)
- func (c *Client) GetSecureValue(projectID, token string) (string, error)
- func (c *Client) GetServer() (*Server, error)
- func (c *Client) GetSnapshotDependencies(buildTypeID string) (*SnapshotDependencyList, error)
- func (c *Client) GetUser(username string) (*User, error)
- func (c *Client) GetVcsRoot(id string) (*VcsRoot, error)
- func (c *Client) GetVcsRootEntries(buildTypeID string) (*VcsRootEntries, error)
- func (c *Client) GetVcsRoots(opts VcsRootsOptions) (*VcsRootList, error)
- func (c *Client) GetVersionedSettingsConfig(projectID string) (*VersionedSettingsConfig, error)
- func (c *Client) GetVersionedSettingsStatus(projectID string) (*VersionedSettingsStatus, error)
- func (c *Client) IsPkceEnabled(ctx context.Context) (bool, error)
- func (c *Client) MoveQueuedBuildToTop(buildID string) error
- func (c *Client) PinBuild(buildID string, comment string) error
- func (c *Client) Probe(ctx context.Context) error
- func (c *Client) ProjectExists(id string) bool
- func (c *Client) RawRequest(ctx context.Context, method, path string, body io.Reader, ...) (*RawResponse, error)
- func (c *Client) RebootAgent(ctx context.Context, id int, afterBuild bool) error
- func (c *Client) RemoveBuildTag(buildID string, tag string) error
- func (c *Client) RemoveFromQueue(id string) error
- func (c *Client) RemoveProjectFromPool(poolID int, projectID string) error
- func (c *Client) ResolveBuildID(ctx context.Context, ref string) (string, error)
- func (c *Client) RunBuild(buildTypeID string, opts RunBuildOptions) (*Build, error)
- func (c *Client) ServerURL() string
- func (c *Client) ServerVersion() (*Server, error)
- func (c *Client) SetAgentPool(agentID int, poolID int) 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) SetCommandName(name string)
- func (c *Client) SetProjectParameter(projectID, name, value string, secure bool) error
- func (c *Client) SetQueuedBuildPosition(buildID string, position int) error
- func (c *Client) StartCloudInstance(imageID string) (*CloudInstance, error)
- func (c *Client) StopCloudInstance(locator string, force bool) error
- func (c *Client) SupportsFeature(feature string) bool
- func (c *Client) TestVcsConnection(req TestConnectionRequest, projectID string) (*TestConnectionResult, error)
- func (c *Client) UnpinBuild(buildID string) error
- func (c *Client) UpdatePipelineYAML(id string, yamlContent string) error
- func (c *Client) UploadDiffChanges(patch []byte, description string) (string, error)
- func (c *Client) UploadSSHKey(projectID, name string, privateKey []byte) error
- func (c *Client) UserExists(username string) bool
- func (c *Client) WaitForBuild(ctx context.Context, buildID string, opts WaitForBuildOptions) (*Build, error)
- func (c *Client) WithContext(ctx context.Context) *Client
- type ClientInterface
- type ClientOption
- func WithAPIVersion(version string) ClientOption
- func WithAuthSource(src AuthSource) ClientOption
- func WithCommandName(name string) ClientOption
- func WithDebugFunc(f func(format string, args ...any)) ClientOption
- func WithExtraHeaders(h map[string]string) ClientOption
- func WithReadOnly(readOnly bool) ClientOption
- func WithTimeout(timeout time.Duration) ClientOption
- func WithVersion(v string) ClientOption
- type CloudImage
- type CloudImageList
- type CloudImageRef
- type CloudImagesOptions
- type CloudInstance
- type CloudInstanceList
- type CloudInstancesOptions
- type CloudProfile
- type CloudProfileList
- type CloudProfilesOptions
- type Compatibility
- type CompatibilityList
- type Content
- type CreateBuildTypeRequest
- type CreatePipelineRequest
- type CreateProjectRequest
- type CreateUserRequest
- type FieldSpec
- type FileChange
- type Files
- type HTTPError
- type IncompatibleReasons
- type LastChanges
- 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) AddLocator(key string, child *Locator) *Locator
- func (l *Locator) AddRaw(key, value string) *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 NetworkError
- type NotFoundError
- type Parameter
- type ParameterList
- type ParameterType
- type PermissionError
- type PersonalChange
- type Pipeline
- type PipelineJob
- type PipelineJobs
- type PipelineList
- type PipelineRef
- type PipelineRun
- type PipelineRunJob
- type PipelineRunJobs
- type PipelineVcsRootRef
- type PipelinesOptions
- type Pool
- type PoolList
- type ProblemOccurrence
- type ProblemOccurrences
- type Project
- type ProjectFeature
- type ProjectFeatureList
- type ProjectList
- type ProjectRef
- type ProjectsOptions
- type Property
- type PropertyList
- type QueueOptions
- type QueuedBuild
- type RawResponse
- type RetryConfig
- type Revision
- type Revisions
- type Role
- type RoleList
- type RunBuildOptions
- type SSHKey
- type SSHKeyList
- type SSHKeyRef
- type Server
- type SnapshotDepBuilds
- type SnapshotDependency
- type SnapshotDependencyList
- type StartCloudInstanceRequest
- type Tag
- type TagList
- type TestConnectionError
- type TestConnectionRequest
- type TestConnectionResult
- type TestOccurrence
- type TestOccurrences
- type Token
- type TokenResponse
- type TriggerBuildRequest
- type Triggered
- type TriggeringOptions
- type UnmetRequirements
- type User
- type UserError
- type ValidationError
- type VcsRoot
- type VcsRootEntries
- type VcsRootEntry
- type VcsRootInstanceRef
- type VcsRootList
- type VcsRootRef
- type VcsRootsOptions
- type VersionedSettingsConfig
- type VersionedSettingsStatus
- type WaitForBuildOptions
- type Wire
- type XMLAPIError
- type XMLAPIErrorResponse
Constants ¶
const ( MinMajorVersion = 2020 MinMinorVersion = 1 )
Minimum supported TeamCity version
const ( PkceIsEnabledPath = "/pkce/is_enabled.html" PkceAuthorizePath = "/pkce/authorize.html" PkceTokenPath = "/pkce/token.html" PkceClientID = "teamcity-cli" CodeChallengeMethod = "S256" )
const EnvHeaderPrefix = "TEAMCITY_HEADER_"
EnvHeaderPrefix is the env-var prefix that contributes extra HTTP headers to every request. TEAMCITY_HEADER_FOO_BAR=value sends "Foo-Bar: value" — underscores become hyphens, name is canonical-cased.
Variables ¶
var ( // ReadRetry is the default for idempotent read operations (GET). // Retries on network errors, 429, 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", "waitReason", "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", "usedByOtherBuilds", }, Default: []string{ "id", "number", "status", "statusText", "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 CloudImageFields = FieldSpec{ Available: []string{"id", "name", "href", "profile.id", "profile.name"}, Default: []string{"id", "name", "href", "profile.id", "profile.name"}, }
var CloudInstanceFields = FieldSpec{ Available: []string{"id", "name", "state", "startDate", "href", "image.id", "image.name", "agent.id", "agent.name"}, Default: []string{"id", "name", "state", "startDate", "href", "image.id", "image.name", "agent.id", "agent.name"}, }
var CloudProfileFields = FieldSpec{ Available: []string{"id", "name", "cloudProviderId", "href", "project.id", "project.name"}, Default: []string{"id", "name", "cloudProviderId", "href"}, }
var ConnectionFields = FieldSpec{ Available: []string{"id", "type", "properties"}, Default: []string{"id", "type", "properties"}, }
var ErrLoginGatewayDetected = errors.New("login gateway detected — VPN may be required")
ErrLoginGatewayDetected indicates the API endpoint was served by an SSO / login gateway rather than TeamCity itself.
var ErrPipelineSchemaUnsupported = errors.New("schema endpoint not available on this server")
ErrPipelineSchemaUnsupported is returned when the server's schema endpoint exists but does not produce JSON, indicating a TeamCity version older than 2026.1.
var KnownPermissions = map[string]string{
"VIEW_PROJECT": "View project and all parent projects",
"VIEW_BUILD_CONFIGURATION_SETTINGS": "View build configuration settings",
"VIEW_AGENT_DETAILS": "View agent details",
"RUN_BUILD": "Run build",
"CANCEL_BUILD": "Stop build / remove from queue",
"TAG_BUILD": "Tag build",
"COMMENT_BUILD": "Comment build",
"PIN_UNPIN_BUILD": "Pin / unpin build",
"PATCH_BUILD_SOURCES": "Change build source code with a custom patch",
"REORDER_BUILD_QUEUE": "Reorder builds in queue",
"PAUSE_ACTIVATE_BUILD_CONFIGURATION": "Pause / activate build configuration",
"EDIT_PROJECT": "Edit project",
"CREATE_SUB_PROJECT": "Create subproject",
"CREATE_DELETE_VCS_ROOT": "Create / delete VCS root",
"CONNECT_TO_AGENT": "Invoke interactive agent terminals",
"ENABLE_DISABLE_AGENT": "Enable / disable agent",
"AUTHORIZE_AGENT": "Authorize agent",
"ADMINISTER_AGENT": "Administer build agent machines (e.g. reboot, view agent logs, etc.)",
"MANAGE_AGENT_POOLS": "Manage agent pools",
}
KnownPermissions maps TeamCity permission enum names to their server-provided descriptions. Keys mirror ALLOWED_PERMISSIONS in oauth-server/.../OAuthServerConstants.java; values are verbatim from server-model/.../Permission.java. Keep in sync when either list changes.
var PipelineFields = FieldSpec{ Available: []string{"id", "name", "webUrl", "parentProject.id", "parentProject.name", "headBuildType.id", "jobs.count"}, Default: []string{"id", "name", "parentProject.id", "parentProject.name", "headBuildType.id", "jobs.count"}, }
var PoolFields = FieldSpec{ Available: []string{"id", "name", "maxAgents", "href"}, Default: []string{"id", "name", "maxAgents"}, }
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", "waitReason", "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", "waitReason", "buildType.id", "buildType.name", "buildType.projectName", "triggered.type", "triggered.user.name", "triggered.user.username", }, }
var SSHKeyFields = FieldSpec{ Available: []string{"name", "encrypted", "publicKey"}, Default: []string{"name", "encrypted", "publicKey"}, }
var VcsRootFields = FieldSpec{ Available: []string{"id", "name", "vcsName", "href", "project.id", "project.name"}, Default: []string{"id", "name", "vcsName", "href", "project.id", "project.name"}, }
Functions ¶
func BuildAuthorizeURL ¶ added in v0.8.0
BuildAuthorizeURL builds the TeamCity PKCE authorize URL with the given parameters.
func DefaultScopes ¶ added in v0.8.0
func DefaultScopes() []string
DefaultScopes returns the curated default scope list for a CLI PKCE login.
func EnvHeaders ¶ added in v0.10.0
EnvHeaders returns TEAMCITY_HEADER_* env vars as a canonical-cased header map; constructors call this implicitly.
func ErrorFromResponse ¶ added in v0.10.0
ErrorFromResponse reads a non-2xx body (capped at maxErrorBody) and returns the typed error.
func ExtractErrorMessage ¶ added in v0.8.1
ExtractErrorMessage returns the primary message from a TeamCity error body.
func FormatTeamCityTime ¶
FormatTeamCityTime formats time to TeamCity's date format.
func IsSandboxBlocked ¶ added in v0.10.0
IsSandboxBlocked reports whether a sandbox is blocking outbound network access.
func ParseTeamCityTime ¶
ParseTeamCityTime parses TeamCity's time format (20250710T080607+0000)
func ParseUserDate ¶
ParseUserDate converts user input (duration like 24h/7d, ISO date, or TC format) to TeamCity date format.
func PermissionEnum ¶ added in v0.10.0
PermissionEnum returns the enum name for a server-provided permission description, or "" if unknown.
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
Fields []string // Fields to return (uses AgentFields.Default if empty)
}
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 AuthSource ¶ added in v0.10.0
type AuthSource string
AuthSource identifies the origin of a Client's credentials, used to pick the right 403 tip.
const ( AuthSourceUnknown AuthSource = "" AuthSourcePKCE AuthSource = "pkce" AuthSourceManual AuthSource = "manual" AuthSourceEnv AuthSource = "env" AuthSourceBuild AuthSource = "build" AuthSourceGuest AuthSource = "guest" )
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"`
Personal bool `json:"personal,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"`
LastChanges *ChangeList `json:"lastChanges,omitempty"`
WaitReason string `json:"waitReason,omitempty"`
UsedByOtherBuilds bool `json:"usedByOtherBuilds,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 BuildMessage ¶ added in v0.9.0
type BuildMessage struct {
ID int `json:"id"`
Text string `json:"text"`
Level int `json:"level"`
Status int `json:"status"`
Timestamp string `json:"timestamp,omitempty"`
ServerTimestamp string `json:"serverTimestamp,omitempty"`
FlowID int `json:"flowId,omitempty"`
ParentID int `json:"parentId,omitempty"`
BlockType string `json:"blockType,omitempty"`
ContainsMessages bool `json:"containsMessages,omitempty"`
Verbose bool `json:"verbose,omitempty"`
}
BuildMessage represents a single message from the build log.
type BuildMessagesOptions ¶ added in v0.9.0
type BuildMessagesOptions struct {
// Count is the number of messages to fetch. Negative values fetch from the tail.
Count int
// SinceID skips messages up to this ID (used as the first param of messagesCount).
SinceID int
// Tail mode fetches from the end of the log.
Tail bool
// ExpandAll looks inside block messages.
ExpandAll bool
}
BuildMessagesOptions controls how messages are fetched.
type BuildMessagesResponse ¶ added in v0.9.0
type BuildMessagesResponse struct {
Messages []BuildMessage `json:"messages"`
LastMessageIndex int `json:"lastMessageIndex"`
FocusIndex int `json:"focusIndex"`
LastMessageIncluded bool `json:"lastMessageIncluded"`
}
BuildMessagesResponse is the response from the /app/messages endpoint.
type BuildQueue ¶
type BuildQueue struct {
Count int `json:"count"`
Href string `json:"href"`
NextHref string `json:"nextHref,omitempty"`
Builds []QueuedBuild `json:"build"`
}
BuildQueue represents the build queue
type BuildRef ¶ added in v0.9.0
type BuildRef struct {
ID int `json:"id,omitempty"`
}
BuildRef is a lightweight reference to a build
type BuildStep ¶
type BuildStep struct {
ID string `json:"id,omitempty"`
Name string `json:"name"`
Type string `json:"type"`
Properties PropertyList `json:"properties"`
}
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 ¶
type BuildTypeList struct {
Count int `json:"count"`
NextHref string `json:"nextHref,omitempty"`
BuildTypes []BuildType `json:"buildType"`
}
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
Revision string
Favorites bool
Limit int
SinceDate string
UntilDate string
Fields []string
}
BuildsOptions represents options for listing builds
func (BuildsOptions) Locator ¶ added in v0.8.3
func (opts BuildsOptions) Locator() *Locator
Locator builds the TeamCity locator used to fetch builds.
type Category ¶ added in v0.10.0
type Category string
Category classifies user-facing errors for UI rendering and JSON output.
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
// DebugFunc, when set, receives debug log messages for HTTP requests/responses.
// Use WithDebugFunc to configure.
DebugFunc func(format string, args ...any)
// ReadOnly, when true, blocks all non-GET requests.
// Use WithReadOnly to configure.
ReadOnly bool
// AuthSource records how credentials were obtained; used for context-aware permission tips.
AuthSource AuthSource
// contains filtered or unexported fields
}
Client represents a TeamCity API client
func NewClient ¶
func NewClient(baseURL, token string, opts ...ClientOption) *Client
NewClient creates a TeamCity API client authenticated with a Bearer token; TEAMCITY_HEADER_* env vars are honored.
func NewClientWithBasicAuth ¶
func NewClientWithBasicAuth(baseURL, username, password string, opts ...ClientOption) *Client
NewClientWithBasicAuth creates a TeamCity API client authenticated with HTTP Basic; TEAMCITY_HEADER_* env vars are honored.
func NewGuestClient ¶ added in v0.7.0
func NewGuestClient(baseURL string, opts ...ClientOption) *Client
NewGuestClient creates a TeamCity API client using /guestAuth/ paths; TEAMCITY_HEADER_* env vars are honored.
func (*Client) AddBuildTags ¶
AddBuildTags adds tags to a build (accepts ID or #number)
func (*Client) AddProjectToPool ¶
AddProjectToPool assigns a project to an agent pool
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) CreatePipeline ¶ added in v0.9.0
CreatePipeline creates a new pipeline in the given project with a VCS root.
func (*Client) CreateProject ¶
func (c *Client) CreateProject(req CreateProjectRequest) (*Project, error)
CreateProject creates a new project
func (*Client) CreateProjectFeature ¶ added in v0.10.0
func (c *Client) CreateProjectFeature(projectID string, feat ProjectFeature) (*ProjectFeature, error)
CreateProjectFeature creates a new project feature (e.g., OAuth connection).
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) CreateVcsRoot ¶ added in v0.9.0
CreateVcsRoot creates a new VCS root
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) DeletePipeline ¶ added in v0.9.0
DeletePipeline deletes a pipeline by removing its project.
func (*Client) DeleteProjectFeature ¶ added in v0.10.0
DeleteProjectFeature removes a project feature by id.
func (*Client) DeleteProjectParameter ¶
DeleteProjectParameter deletes a parameter from a project
func (*Client) DeleteSSHKey ¶ added in v0.9.0
DeleteSSHKey deletes an SSH key from a project
func (*Client) DeleteVcsRoot ¶ added in v0.9.0
DeleteVcsRoot deletes a VCS root by ID
func (*Client) DownloadArtifact ¶
func (c *Client) DownloadArtifact(ctx context.Context, buildID, artifactPath string) ([]byte, error)
DownloadArtifact downloads an artifact and returns its content (accepts ID or #number)
func (*Client) DownloadArtifactTo ¶
func (c *Client) DownloadArtifactTo(ctx context.Context, buildID, artifactPath string, w io.Writer) (int64, error)
DownloadArtifactTo streams an artifact to w using a timeout-less client bounded by ctx.
func (*Client) EnableAgent ¶
EnableAgent sets the enabled status of an agent
func (*Client) ExchangeCodeForToken ¶ added in v0.10.0
func (c *Client) ExchangeCodeForToken(ctx context.Context, code, verifier, redirectURI string) (*TokenResponse, error)
ExchangeCodeForToken trades a PKCE authorization code for an access token at c.BaseURL.
func (*Client) ExportProjectSettings ¶
func (c *Client) ExportProjectSettings(projectID, format string, useRelativeIds bool) ([]byte, error)
ExportProjectSettings exports project settings as a ZIP archive in the specified format. Format can be "kotlin" or "xml". Returns the raw ZIP file bytes.
func (*Client) GenerateSSHKey ¶ added in v0.9.0
GenerateSSHKey generates an SSH key pair in a project and returns the key with public key
func (*Client) GetAgentBuildTypeCompatibility ¶ added in v0.10.0
func (c *Client) GetAgentBuildTypeCompatibility(agentID int, buildTypeID string, maxScan int) (*Compatibility, error)
GetAgentBuildTypeCompatibility finds the (agent, buildType) entry in incompatibleBuildTypes, scanning at most maxScan.
func (*Client) GetAgentByName ¶
GetAgentByName returns details for an agent by name. PathEscape is sufficient here: TeamCity prohibits colons and commas in agent names (they conflict with locator syntax), so we only need to escape path-unsafe characters.
func (*Client) GetAgentCompatibleBuildTypes ¶
func (c *Client) GetAgentCompatibleBuildTypes(id int) (*BuildTypeList, error)
GetAgentCompatibleBuildTypes returns build types compatible with an agent
func (*Client) GetAgentIncompatibleBuildTypes ¶
func (c *Client) GetAgentIncompatibleBuildTypes(id int) (*CompatibilityList, error)
GetAgentIncompatibleBuildTypes returns build types incompatible with an agent and reasons
func (*Client) GetAgentPool ¶
GetAgentPool returns details for a single pool
func (*Client) GetAgentPools ¶
GetAgentPools returns all agent pools, automatically following pagination.
func (*Client) GetAgents ¶
func (c *Client) GetAgents(opts AgentsOptions) (*AgentList, error)
GetAgents returns a list of agents, automatically following pagination.
func (*Client) GetArtifacts ¶
func (c *Client) GetArtifacts(ctx context.Context, buildID string, subpath string) (*Artifacts, error)
GetArtifacts returns a build's artifacts, optionally scoped to subpath.
func (*Client) GetBuildChanges ¶
func (*Client) GetBuildComment ¶
GetBuildComment returns the comment for a build (accepts ID or #number)
func (*Client) GetBuildCompatibleAgents ¶ added in v0.10.0
GetBuildCompatibleAgents returns agents compatible with the given build, including disconnected ones.
func (*Client) GetBuildIncompatibleAgents ¶ added in v0.10.0
GetBuildIncompatibleAgents returns agents incompatible with the given build.
func (*Client) GetBuildLog ¶
GetBuildLog returns the build log (accepts ID or #number)
func (*Client) GetBuildMessages ¶ added in v0.9.0
func (c *Client) GetBuildMessages(ctx context.Context, buildID string, opts BuildMessagesOptions) (*BuildMessagesResponse, error)
GetBuildMessages fetches structured log messages via /app/messages.
func (*Client) GetBuildPipelineRun ¶ added in v0.9.0
func (c *Client) GetBuildPipelineRun(buildID string) (*PipelineRun, error)
GetBuildPipelineRun fetches pipeline run metadata for a build. Returns nil if the build is not a pipeline run.
func (*Client) GetBuildProblems ¶
func (c *Client) GetBuildProblems(buildID string) (*ProblemOccurrences, error)
func (*Client) GetBuildQueue ¶
func (c *Client) GetBuildQueue(opts QueueOptions) (*BuildQueue, error)
GetBuildQueue returns the build queue, automatically following pagination.
func (*Client) GetBuildResultingProperties ¶ added in v0.9.0
func (c *Client) GetBuildResultingProperties(buildID string) (*ParameterList, error)
func (*Client) GetBuildSnapshotDependencies ¶ added in v0.9.0
GetBuildSnapshotDependencies returns all immediate dependency builds in a snapshot dependency chain.
func (*Client) GetBuildTags ¶
GetBuildTags returns the tags for a build (accepts ID or #number)
func (*Client) GetBuildTestSummary ¶ added in v0.9.0
func (c *Client) GetBuildTestSummary(buildID string) (*TestOccurrences, error)
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, automatically following pagination.
func (*Client) GetBuildUsedByOtherBuilds ¶ added in v0.9.0
GetBuildUsedByOtherBuilds checks whether a build's results were shared with other builds. This field is not included in TC's default response, so it requires a targeted request.
func (*Client) GetCloudImage ¶ added in v0.9.0
func (c *Client) GetCloudImage(locator string) (*CloudImage, error)
func (*Client) GetCloudImages ¶ added in v0.9.0
func (c *Client) GetCloudImages(opts CloudImagesOptions) (*CloudImageList, error)
func (*Client) GetCloudInstance ¶ added in v0.9.0
func (c *Client) GetCloudInstance(locator string) (*CloudInstance, error)
func (*Client) GetCloudInstances ¶ added in v0.9.0
func (c *Client) GetCloudInstances(opts CloudInstancesOptions) (*CloudInstanceList, error)
func (*Client) GetCloudProfile ¶ added in v0.9.0
func (c *Client) GetCloudProfile(locator string) (*CloudProfile, error)
func (*Client) GetCloudProfiles ¶ added in v0.9.0
func (c *Client) GetCloudProfiles(opts CloudProfilesOptions) (*CloudProfileList, error)
func (*Client) GetCurrentUser ¶
GetCurrentUser returns the authenticated user
func (*Client) GetDependentBuildTypes ¶ added in v0.7.0
func (c *Client) GetDependentBuildTypes(buildTypeID string) (*BuildTypeList, error)
GetDependentBuildTypes returns build types that have a snapshot dependency on the given build type.
func (*Client) GetParameterValue ¶
GetParameterValue returns just the raw value of a parameter
func (*Client) GetPipeline ¶ added in v0.9.0
GetPipeline retrieves a single pipeline by ID via the REST API.
func (*Client) GetPipelineSchema ¶ added in v0.9.0
GetPipelineSchema fetches the pipeline JSON schema from the server.
func (*Client) GetPipelineYAML ¶ added in v0.9.0
GetPipelineYAML retrieves the YAML source of a pipeline. Returns empty string if the pipeline stores YAML in VCS.
func (*Client) GetPipelines ¶ added in v0.9.0
func (c *Client) GetPipelines(opts PipelinesOptions) (*PipelineList, error)
GetPipelines lists pipelines, optionally filtered by project. Automatically follows pagination.
func (*Client) GetProject ¶
GetProject returns a single project by ID
func (*Client) GetProjectConnections ¶ added in v0.9.0
func (c *Client) GetProjectConnections(projectID string) (*ProjectFeatureList, error)
GetProjectConnections returns OAuth/connection features for a project
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, automatically following pagination.
func (*Client) GetQueuedBuildApprovalInfo ¶
func (c *Client) GetQueuedBuildApprovalInfo(buildID string) (*ApprovalInfo, error)
GetQueuedBuildApprovalInfo returns approval information for a queued build
func (*Client) GetSSHKeys ¶ added in v0.9.0
func (c *Client) GetSSHKeys(projectID string) (*SSHKeyList, error)
GetSSHKeys returns SSH keys uploaded to a project
func (*Client) GetSecureValue ¶
GetSecureValue retrieves the original value for a secure token. Requires CHANGE_SERVER_SETTINGS permission (System Administrator only).
func (*Client) GetSnapshotDependencies ¶ added in v0.7.0
func (c *Client) GetSnapshotDependencies(buildTypeID string) (*SnapshotDependencyList, error)
GetSnapshotDependencies returns the snapshot dependencies for a build configuration
func (*Client) GetVcsRoot ¶ added in v0.9.0
GetVcsRoot returns a VCS root by ID
func (*Client) GetVcsRootEntries ¶
func (c *Client) GetVcsRootEntries(buildTypeID string) (*VcsRootEntries, error)
GetVcsRootEntries returns the VCS root entries attached to a build configuration
func (*Client) GetVcsRoots ¶ added in v0.9.0
func (c *Client) GetVcsRoots(opts VcsRootsOptions) (*VcsRootList, error)
GetVcsRoots returns a list of VCS roots, automatically following pagination.
func (*Client) GetVersionedSettingsConfig ¶
func (c *Client) GetVersionedSettingsConfig(projectID string) (*VersionedSettingsConfig, error)
GetVersionedSettingsConfig returns the versioned settings configuration for a project.
func (*Client) GetVersionedSettingsStatus ¶
func (c *Client) GetVersionedSettingsStatus(projectID string) (*VersionedSettingsStatus, error)
GetVersionedSettingsStatus returns the sync status of versioned settings for a project.
func (*Client) IsPkceEnabled ¶ added in v0.10.0
IsPkceEnabled reports whether the server at c.BaseURL advertises PKCE support.
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) Probe ¶ added in v0.10.0
Probe checks whether c.BaseURL points to a reachable TeamCity server without sending credentials.
func (*Client) ProjectExists ¶
ProjectExists checks if a project exists
func (*Client) RawRequest ¶
func (c *Client) RawRequest(ctx context.Context, 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) RebootAgent ¶
RebootAgent requests a reboot of the specified agent. If afterBuild is true, the agent will reboot after the current build finishes. This uses the web UI endpoint as there is no REST API for agent reboot.
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) RemoveProjectFromPool ¶
RemoveProjectFromPool removes a project from an agent pool
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) SetAgentPool ¶
SetAgentPool moves an agent to a different pool
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) SetCommandName ¶ added in v0.8.3
SetCommandName sets the command name for X-TeamCity-Client header.
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) StartCloudInstance ¶ added in v0.9.0
func (c *Client) StartCloudInstance(imageID string) (*CloudInstance, error)
func (*Client) StopCloudInstance ¶ added in v0.9.0
func (*Client) SupportsFeature ¶
SupportsFeature checks if the server supports a specific feature
func (*Client) TestVcsConnection ¶ added in v0.9.0
func (c *Client) TestVcsConnection(req TestConnectionRequest, projectID string) (*TestConnectionResult, error)
TestVcsConnection tests a VCS connection before creating a root. Uses the pipeline endpoint which returns HTTP 200 with status/errors in the body.
func (*Client) UnpinBuild ¶
UnpinBuild removes the pin from a build (accepts ID or #number)
func (*Client) UpdatePipelineYAML ¶ added in v0.9.0
UpdatePipelineYAML replaces the YAML content of an existing pipeline. Preserves all other pipeline settings (VCS root, triggers, notifications).
func (*Client) UploadDiffChanges ¶
func (*Client) UploadSSHKey ¶ added in v0.9.0
UploadSSHKey uploads a private SSH key to a project
func (*Client) UserExists ¶
UserExists checks if a user exists
func (*Client) WaitForBuild ¶ added in v0.8.1
func (c *Client) WaitForBuild(ctx context.Context, buildID string, opts WaitForBuildOptions) (*Build, error)
WaitForBuild polls a build until it reaches state "finished", then returns the full build. Uses lightweight field-limited requests for polling, and fetches the complete build only once.
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)
GetVersionedSettingsStatus(projectID string) (*VersionedSettingsStatus, error)
GetVersionedSettingsConfig(projectID string) (*VersionedSettingsConfig, error)
ExportProjectSettings(projectID, format string, useRelativeIds bool) ([]byte, 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
GetSnapshotDependencies(buildTypeID string) (*SnapshotDependencyList, error)
GetDependentBuildTypes(buildTypeID string) (*BuildTypeList, error)
GetVcsRootEntries(buildTypeID string) (*VcsRootEntries, error)
SetBuildTypeSetting(buildTypeID, setting, value string) error
// Builds (Runs)
GetBuilds(ctx context.Context, opts BuildsOptions) (*BuildList, error)
GetBuild(ctx context.Context, ref string) (*Build, error)
GetBuildUsedByOtherBuilds(id string) (bool, error)
WaitForBuild(ctx context.Context, buildID string, opts WaitForBuildOptions) (*Build, error)
ResolveBuildID(ctx context.Context, ref string) (string, error)
RunBuild(buildTypeID string, opts RunBuildOptions) (*Build, error)
CancelBuild(buildID string, comment string) error
GetBuildLog(ctx context.Context, buildID string) (string, error)
GetBuildMessages(ctx context.Context, buildID string, opts BuildMessagesOptions) (*BuildMessagesResponse, 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
GetBuildSnapshotDependencies(buildID string) (*BuildList, error)
GetBuildChanges(ctx context.Context, buildID string) (*ChangeList, error)
GetBuildTests(ctx context.Context, buildID string, failedOnly bool, limit int) (*TestOccurrences, error)
GetBuildTestSummary(buildID string) (*TestOccurrences, error)
GetBuildProblems(buildID string) (*ProblemOccurrences, error)
GetBuildResultingProperties(buildID string) (*ParameterList, error)
UploadDiffChanges(patch []byte, description string) (string, error)
// Artifacts
GetArtifacts(ctx context.Context, buildID string, path string) (*Artifacts, error)
DownloadArtifact(ctx context.Context, buildID, artifactPath string) ([]byte, error)
DownloadArtifactTo(ctx context.Context, buildID, artifactPath string, w io.Writer) (int64, 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)
GetAgent(id int) (*Agent, error)
GetAgentByName(name string) (*Agent, error)
AuthorizeAgent(id int, authorized bool) error
EnableAgent(id int, enabled bool) error
RebootAgent(ctx context.Context, id int, afterBuild bool) error
GetAgentCompatibleBuildTypes(id int) (*BuildTypeList, error)
GetAgentIncompatibleBuildTypes(id int) (*CompatibilityList, error)
GetBuildCompatibleAgents(buildID int) (*AgentList, error)
GetBuildIncompatibleAgents(buildID int) (*AgentList, error)
GetAgentBuildTypeCompatibility(agentID int, buildTypeID string, maxScan int) (*Compatibility, error)
// Agent Pools
GetAgentPools(fields []string) (*PoolList, error)
GetAgentPool(id int) (*Pool, error)
AddProjectToPool(poolID int, projectID string) error
RemoveProjectFromPool(poolID int, projectID string) error
SetAgentPool(agentID int, poolID int) error
// Cloud
GetCloudProfiles(opts CloudProfilesOptions) (*CloudProfileList, error)
GetCloudProfile(locator string) (*CloudProfile, error)
GetCloudImages(opts CloudImagesOptions) (*CloudImageList, error)
GetCloudImage(locator string) (*CloudImage, error)
GetCloudInstances(opts CloudInstancesOptions) (*CloudInstanceList, error)
GetCloudInstance(locator string) (*CloudInstance, error)
StartCloudInstance(imageID string) (*CloudInstance, error)
StopCloudInstance(locator string, force bool) error
// Pipelines
GetBuildPipelineRun(buildID string) (*PipelineRun, error)
GetPipelines(opts PipelinesOptions) (*PipelineList, error)
GetPipeline(id string) (*Pipeline, error)
GetPipelineYAML(id string) (string, error)
CreatePipeline(parentProjectID, name, yaml, vcsRootID string) (*Pipeline, error)
UpdatePipelineYAML(id string, yaml string) error
DeletePipeline(id string) error
GetPipelineSchema() ([]byte, error)
// VCS Roots
GetVcsRoots(opts VcsRootsOptions) (*VcsRootList, error)
GetVcsRoot(id string) (*VcsRoot, error)
CreateVcsRoot(root VcsRoot) (*VcsRoot, error)
DeleteVcsRoot(id string) error
TestVcsConnection(req TestConnectionRequest, projectID string) (*TestConnectionResult, error)
// SSH Keys
GetSSHKeys(projectID string) (*SSHKeyList, error)
UploadSSHKey(projectID, name string, privateKey []byte) error
GenerateSSHKey(projectID, name, keyType string) (*SSHKey, error)
DeleteSSHKey(projectID, name string) error
// Project Connections
GetProjectConnections(projectID string) (*ProjectFeatureList, error)
CreateProjectFeature(projectID string, feat ProjectFeature) (*ProjectFeature, error)
DeleteProjectFeature(projectID, featureID string) error
// Raw API access
RawRequest(ctx context.Context, method, path string, body io.Reader, headers map[string]string) (*RawResponse, error)
// Client metadata
SetCommandName(name string)
ServerURL() string
}
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 WithAuthSource ¶ added in v0.10.0
func WithAuthSource(src AuthSource) ClientOption
WithAuthSource records how the client's credentials were obtained.
func WithCommandName ¶ added in v0.8.3
func WithCommandName(name string) ClientOption
WithCommandName sets the command name for X-TeamCity-Client header.
func WithDebugFunc ¶
func WithDebugFunc(f func(format string, args ...any)) ClientOption
WithDebugFunc sets a function to receive debug log messages for HTTP requests/responses.
func WithExtraHeaders ¶ added in v0.10.0
func WithExtraHeaders(h map[string]string) ClientOption
WithExtraHeaders replaces the headers applied to every request; nil/empty clears env-loaded extras.
func WithReadOnly ¶ added in v0.7.0
func WithReadOnly(readOnly bool) ClientOption
WithReadOnly sets the client to read-only mode, blocking all non-GET requests.
func WithTimeout ¶
func WithTimeout(timeout time.Duration) ClientOption
WithTimeout sets a custom HTTP timeout
func WithVersion ¶ added in v0.8.3
func WithVersion(v string) ClientOption
WithVersion sets the CLI version for request identification headers.
type CloudImage ¶ added in v0.9.0
type CloudImage struct {
ID string `json:"id"`
Name string `json:"name,omitempty"`
Href string `json:"href,omitempty"`
Profile *CloudProfile `json:"profile,omitempty"`
Project *Project `json:"project,omitempty"`
}
CloudImage represents a cloud image within a cloud profile
type CloudImageList ¶ added in v0.9.0
type CloudImageList struct {
Count int `json:"count"`
NextHref string `json:"nextHref,omitempty"`
Images []CloudImage `json:"cloudImage"`
}
type CloudImageRef ¶ added in v0.9.0
type CloudImageRef struct {
ID string `json:"id"`
}
CloudImageRef is a reference to a cloud image
type CloudImagesOptions ¶ added in v0.9.0
type CloudInstance ¶ added in v0.9.0
type CloudInstance struct {
ID string `json:"id"`
Name string `json:"name,omitempty"`
State string `json:"state,omitempty"`
StartDate string `json:"startDate,omitempty"`
Href string `json:"href,omitempty"`
Image *CloudImage `json:"image,omitempty"`
Agent *Agent `json:"agent,omitempty"`
}
CloudInstance represents a running cloud instance
type CloudInstanceList ¶ added in v0.9.0
type CloudInstanceList struct {
Count int `json:"count"`
NextHref string `json:"nextHref,omitempty"`
Instances []CloudInstance `json:"cloudInstance"`
}
type CloudInstancesOptions ¶ added in v0.9.0
type CloudProfile ¶ added in v0.9.0
type CloudProfile struct {
ID string `json:"id"`
Name string `json:"name,omitempty"`
CloudProviderID string `json:"cloudProviderId,omitempty"`
Href string `json:"href,omitempty"`
Project *Project `json:"project,omitempty"`
}
CloudProfile represents a cloud profile configured in a project
type CloudProfileList ¶ added in v0.9.0
type CloudProfileList struct {
Count int `json:"count"`
NextHref string `json:"nextHref,omitempty"`
Profiles []CloudProfile `json:"cloudProfile"`
}
type CloudProfilesOptions ¶ added in v0.9.0
type Compatibility ¶
type Compatibility struct {
Compatible bool `json:"compatible"`
BuildType *BuildType `json:"buildType,omitempty"`
Agent *Agent `json:"agent,omitempty"`
Reasons *IncompatibleReasons `json:"incompatibleReasons,omitempty"`
UnmetRequirements *UnmetRequirements `json:"unmetRequirements,omitempty"`
}
Compatibility represents build type compatibility info
func (*Compatibility) ReasonsList ¶ added in v0.10.0
func (c *Compatibility) ReasonsList() []string
ReasonsList merges the legacy incompatibleReasons.reason array with unmetRequirements.description.
type CompatibilityList ¶
type CompatibilityList struct {
Count int `json:"count"`
Compatibility []Compatibility `json:"compatibility"`
}
CompatibilityList represents a list of compatibility entries
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 CreatePipelineRequest ¶ added in v0.9.0
type CreatePipelineRequest struct {
Name string `json:"name"`
YAML string `json:"yaml"`
VcsRoot *PipelineVcsRootRef `json:"vcsRoot,omitempty"`
}
CreatePipelineRequest represents a request to create a pipeline
type CreateProjectRequest ¶
type CreateProjectRequest struct {
ID string `json:"id,omitempty"`
Name string `json:"name"`
ParentProject *ProjectRef `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"`
}
CreateUserRequest represents a request to create a user
type FileChange ¶
type Files ¶
type Files struct {
File []FileChange `json:"file"`
}
type HTTPError ¶ added in v0.10.0
HTTPError covers HTTP-derived errors without extra structured fields (401, generic 4xx/5xx).
type IncompatibleReasons ¶
type IncompatibleReasons struct {
Reasons []string `json:"reason,omitempty"`
}
IncompatibleReasons contains reasons why an agent can't run a build type
type LastChanges ¶
type LastChanges struct {
Change []PersonalChange `json:"change"`
}
LastChanges represents the changes to include in a build
type Locator ¶
type Locator struct {
// contains filtered or unexported fields
}
func NewLocator ¶
func NewLocator() *Locator
func (*Locator) AddIntDefault ¶
func (*Locator) AddLocator ¶ added in v0.8.3
AddLocator adds a nested locator as key:(...)
type NetworkError ¶
NetworkError wraps transport-level failures (DNS, connect, TLS, timeout).
func (*NetworkError) Category ¶ added in v0.10.0
func (*NetworkError) Category() Category
func (*NetworkError) Error ¶
func (e *NetworkError) Error() string
func (*NetworkError) Unwrap ¶
func (e *NetworkError) Unwrap() error
type NotFoundError ¶
type NotFoundError struct {
HTTPError
Resource string // "job", "run", "project", "user", "agent"
ID string
}
NotFoundError is returned for HTTP 404 responses.
func (*NotFoundError) Error ¶
func (e *NotFoundError) Error() string
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 PermissionError ¶
type PermissionError struct {
HTTPError
Permission string // e.g. "Comment build"
Project string // TeamCity internal project id
AuthSource AuthSource // how the client authenticated; drives the tip wording
}
PermissionError is returned for HTTP 403 responses.
func (*PermissionError) Error ¶
func (e *PermissionError) Error() string
type PersonalChange ¶
PersonalChange represents a personal change (uploaded diff) reference
type Pipeline ¶ added in v0.9.0
type Pipeline struct {
ID string `json:"id"`
Name string `json:"name,omitempty"`
WebURL string `json:"webUrl,omitempty"`
HeadBuildType *BuildTypeRef `json:"headBuildType,omitempty"`
Jobs *PipelineJobs `json:"jobs,omitempty"`
ParentProject *ProjectRef `json:"parentProject,omitempty"`
YAML string `json:"yaml,omitempty"`
}
Pipeline represents a TeamCity pipeline (YAML configuration)
type PipelineJob ¶ added in v0.9.0
PipelineJob represents a single job in a pipeline (uses YAML keys, not generated IDs)
type PipelineJobs ¶ added in v0.9.0
type PipelineJobs struct {
Count int `json:"count"`
Job []PipelineJob `json:"job,omitempty"`
}
PipelineJobs represents the jobs within a pipeline
type PipelineList ¶ added in v0.9.0
type PipelineList struct {
Count int `json:"count"`
NextHref string `json:"nextHref,omitempty"`
Pipelines []Pipeline `json:"pipeline,omitempty"`
}
PipelineList represents a list of pipelines
type PipelineRef ¶ added in v0.9.0
PipelineRef is a lightweight reference to a pipeline
type PipelineRun ¶ added in v0.9.0
type PipelineRun struct {
Number string `json:"number,omitempty"`
Pipeline *PipelineRef `json:"pipeline,omitempty"`
Jobs *PipelineRunJobs `json:"jobs,omitempty"`
}
PipelineRun represents pipeline execution metadata on a build
type PipelineRunJob ¶ added in v0.9.0
type PipelineRunJob struct {
ID string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Build *BuildRef `json:"build,omitempty"`
}
PipelineRunJob represents a job within a pipeline run
type PipelineRunJobs ¶ added in v0.9.0
type PipelineRunJobs struct {
Count int `json:"count,omitempty"`
Job []PipelineRunJob `json:"job,omitempty"`
}
PipelineRunJobs represents jobs within a pipeline run
type PipelineVcsRootRef ¶ added in v0.9.0
type PipelineVcsRootRef struct {
ExternalVcsRootID string `json:"externalVcsRootId"`
}
PipelineVcsRootRef references an existing VCS root for pipeline creation
type PipelinesOptions ¶ added in v0.9.0
PipelinesOptions represents options for listing pipelines
type Pool ¶
type Pool struct {
ID int `json:"id,omitempty"`
Name string `json:"name,omitempty"`
Href string `json:"href,omitempty"`
MaxAgents int `json:"maxAgents,omitempty"`
Projects *ProjectList `json:"projects,omitempty"`
Agents *AgentList `json:"agents,omitempty"`
}
Pool represents an agent pool
type PoolList ¶
type PoolList struct {
Count int `json:"count"`
NextHref string `json:"nextHref,omitempty"`
Pools []Pool `json:"agentPool"`
}
PoolList represents a list of agent pools
type ProblemOccurrence ¶
type ProblemOccurrences ¶
type ProblemOccurrences struct {
Count int `json:"count"`
ProblemOccurrence []ProblemOccurrence `json:"problemOccurrence"`
}
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 ProjectFeature ¶ added in v0.9.0
type ProjectFeature struct {
ID string `json:"id"`
Type string `json:"type"`
Properties *PropertyList `json:"properties,omitempty"`
}
ProjectFeature represents a project-level feature (connection, etc.)
type ProjectFeatureList ¶ added in v0.9.0
type ProjectFeatureList struct {
Count int `json:"count"`
ProjectFeature []ProjectFeature `json:"projectFeature"`
}
ProjectFeatureList represents a list of project features
type ProjectList ¶
type ProjectList struct {
Count int `json:"count"`
NextHref string `json:"nextHref,omitempty"`
Projects []Project `json:"project"`
}
ProjectList represents a list of projects
type ProjectRef ¶ added in v0.9.0
ProjectRef is a lightweight reference to a project
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"`
WaitReason string `json:"waitReason,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 Revision ¶
type Revision struct {
Version string `json:"version"`
VcsBranchName string `json:"vcsBranchName,omitempty"`
VcsRootInstance *VcsRootInstanceRef `json:"vcs-root-instance,omitempty"`
}
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
PersonalChangeID string
Revision string
SnapshotDependencies []int
}
RunBuildOptions represents options for running a build
type SSHKey ¶ added in v0.9.0
type SSHKey struct {
Name string `json:"name"`
Encrypted bool `json:"encrypted"`
PublicKey string `json:"publicKey,omitempty"`
Project *Project `json:"project,omitempty"`
}
SSHKey represents an SSH key uploaded to a TeamCity project
type SSHKeyList ¶ added in v0.9.0
type SSHKeyList struct {
SSHKey []SSHKey `json:"sshKey"`
}
SSHKeyList represents a list of SSH keys
type SSHKeyRef ¶ added in v0.9.0
type SSHKeyRef struct {
Name string `json:"name"`
}
SSHKeyRef references an SSH key by name for test connection requests
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 SnapshotDepBuilds ¶ added in v0.9.0
type SnapshotDepBuilds struct {
Build []BuildRef `json:"build"`
}
type SnapshotDependency ¶ added in v0.7.0
type SnapshotDependency struct {
ID string `json:"id"`
SourceBuildType *BuildType `json:"source-buildType,omitempty"`
}
SnapshotDependency represents a snapshot dependency between build configurations
type SnapshotDependencyList ¶ added in v0.7.0
type SnapshotDependencyList struct {
Count int `json:"count"`
SnapshotDependency []SnapshotDependency `json:"snapshot-dependency"`
}
SnapshotDependencyList represents a list of snapshot dependencies
type StartCloudInstanceRequest ¶ added in v0.9.0
type StartCloudInstanceRequest struct {
Image CloudImageRef `json:"image"`
}
StartCloudInstanceRequest is the body for starting a cloud instance
type TestConnectionError ¶ added in v0.9.0
type TestConnectionError struct {
Message string `json:"message"`
StackTrace string `json:"stackTrace,omitempty"`
AdditionalMessage string `json:"additionalMessage,omitempty"`
}
TestConnectionError represents an error from a connection test
type TestConnectionRequest ¶ added in v0.9.0
type TestConnectionRequest struct {
URL string `json:"url"`
VcsName string `json:"vcsName"`
IsPrivate bool `json:"isPrivate"`
ConnectionID string `json:"connectionId,omitempty"`
Username string `json:"username,omitempty"`
Password string `json:"password,omitempty"`
SSHKey *SSHKeyRef `json:"sshKey,omitempty"`
}
TestConnectionRequest represents a request to test a VCS connection
type TestConnectionResult ¶ added in v0.9.0
type TestConnectionResult struct {
Status string `json:"status"`
Errors []TestConnectionError `json:"errors"`
}
TestConnectionResult represents the result of a VCS connection test
type TestOccurrence ¶
type TestOccurrence struct {
ID string `json:"id"`
Name string `json:"name"`
Status string `json:"status"` // SUCCESS, FAILURE, IGNORED
Duration int `json:"duration,omitempty"`
Details string `json:"details,omitempty"`
NewFailure bool `json:"newFailure,omitempty"`
Ignored bool `json:"ignored,omitempty"`
Href string `json:"href,omitempty"`
FirstFailed *TestOccurrence `json:"firstFailed,omitempty"`
Build *Build `json:"build,omitempty"`
}
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 TokenResponse ¶ added in v0.8.0
type TokenResponse struct {
AccessToken string `json:"access_token"`
TokenType string `json:"token_type"`
ValidUntil string `json:"valid_until"`
}
TokenResponse is TeamCity's reply to a successful PKCE token exchange.
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"`
LastChanges *LastChanges `json:"lastChanges,omitempty"`
Revisions *Revisions `json:"revisions,omitempty"`
SnapshotDependencies *SnapshotDepBuilds `json:"snapshot-dependencies,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
type UnmetRequirements ¶ added in v0.10.0
type UnmetRequirements struct {
Description string `json:"description,omitempty"`
}
UnmetRequirements holds the human-readable incompatibility description (may be multi-line).
type User ¶
type User struct {
ID int `json:"id,omitempty"`
Username string `json:"username,omitempty"`
Name string `json:"name,omitempty"`
Email string `json:"email,omitempty"`
Href string `json:"href,omitempty"`
}
User represents a TeamCity user
type UserError ¶ added in v0.10.0
UserError is the contract consumed by the CLI renderer.
var ErrReadOnly UserError = readOnlyError{}
ErrReadOnly is returned when a non-GET request is attempted in read-only mode.
type ValidationError ¶ added in v0.10.0
ValidationError is a CLI-constructed user-input error with an optional imperative Tip.
func MutuallyExclusive ¶ added in v0.10.0
func MutuallyExclusive(arg, flag string) *ValidationError
MutuallyExclusive is a validation error for conflicting options.
func RequiredFlag ¶ added in v0.10.0
func RequiredFlag(flag string) *ValidationError
RequiredFlag is a validation error for missing required flags in non-interactive mode.
func Validation ¶ added in v0.10.0
func Validation(msg, tip string) *ValidationError
Validation wraps a user-input error with an imperative tip.
func (*ValidationError) Category ¶ added in v0.10.0
func (*ValidationError) Category() Category
func (*ValidationError) Error ¶ added in v0.10.0
func (e *ValidationError) Error() string
func (*ValidationError) Suggestion ¶ added in v0.10.0
func (e *ValidationError) Suggestion() string
type VcsRoot ¶ added in v0.9.0
type VcsRoot struct {
ID string `json:"id,omitempty"`
Name string `json:"name,omitempty"`
VcsName string `json:"vcsName,omitempty"`
Href string `json:"href,omitempty"`
Project *Project `json:"project,omitempty"`
Properties *PropertyList `json:"properties,omitempty"`
// ConnectionID is POST-only: server resolves authMethod/username/tokenId from the named connection.
ConnectionID string `json:"connectionId,omitempty"`
}
VcsRoot represents a TeamCity VCS root
type VcsRootEntries ¶
type VcsRootEntries struct {
Count int `json:"count"`
VcsRootEntry []VcsRootEntry `json:"vcs-root-entry"`
}
type VcsRootEntry ¶
type VcsRootEntry struct {
ID string `json:"id,omitempty"`
VcsRoot *VcsRootRef `json:"vcs-root,omitempty"`
}
type VcsRootInstanceRef ¶
type VcsRootInstanceRef struct {
VcsRootID string `json:"vcs-root-id"`
}
type VcsRootList ¶ added in v0.9.0
type VcsRootList struct {
Count int `json:"count"`
NextHref string `json:"nextHref,omitempty"`
VcsRoot []VcsRoot `json:"vcs-root"`
}
VcsRootList represents a list of VCS roots
type VcsRootRef ¶
type VcsRootsOptions ¶ added in v0.9.0
VcsRootsOptions represents options for listing VCS roots
type VersionedSettingsConfig ¶
type VersionedSettingsConfig struct {
SynchronizationMode string `json:"synchronizationMode,omitempty"` // enabled, disabled
Format string `json:"format,omitempty"` // kotlin, xml
BuildSettingsMode string `json:"buildSettingsMode,omitempty"` // useFromVCS, useCurrentByDefault
VcsRootID string `json:"vcsRootId,omitempty"`
SettingsPath string `json:"settingsPath,omitempty"`
AllowUIEditing bool `json:"allowUIEditing,omitempty"`
ShowSettingsChanges bool `json:"showSettingsChanges,omitempty"`
}
VersionedSettingsConfig represents the configuration of versioned settings
type VersionedSettingsStatus ¶
type VersionedSettingsStatus struct {
Type string `json:"type,omitempty"` // info, warning, error
Message string `json:"message,omitempty"` // Human-readable status message
Timestamp string `json:"timestamp,omitempty"` // When the status was recorded
DslOutdated bool `json:"dslOutdated,omitempty"` // DSL scripts need regeneration
}
VersionedSettingsStatus represents the sync status of versioned settings
type WaitForBuildOptions ¶ added in v0.8.1
type WaitForBuildOptions struct {
Interval time.Duration
// OnProgress is called after each poll with the current state.
// Return a non-nil error to abort the wait.
OnProgress func(state, status string, percent int) error
}
WaitForBuildOptions configures the WaitForBuild polling behavior.
type Wire ¶ added in v0.10.0
type Wire struct {
Message, Additional, StatusText string
}
Wire holds the fields parsed from a TeamCity error response body.
type XMLAPIError ¶ added in v0.8.1
type XMLAPIError struct {
Message string `xml:"message" json:"message"`
AdditionalMessage string `xml:"additionalMessage" json:"additionalMessage,omitempty"`
StatusText string `xml:"statusText" json:"statusText,omitempty"`
}
XMLAPIError represents a single error in TeamCity's XML error response.
type XMLAPIErrorResponse ¶ added in v0.8.1
type XMLAPIErrorResponse struct {
XMLName xml.Name `xml:"errors" json:"-"`
Errors []XMLAPIError `xml:"error" json:"errors"`
}
XMLAPIErrorResponse represents TeamCity's XML error response format.
func ParseXMLErrors ¶ added in v0.8.1
func ParseXMLErrors(body []byte) *XMLAPIErrorResponse
ParseXMLErrors parses a TeamCity XML error response, returning nil if body is not one.
Source Files
¶
- agents.go
- auth_source.go
- builds.go
- builds_artifacts.go
- builds_metadata.go
- builds_queue.go
- client.go
- cloud.go
- connections.go
- dateutil.go
- errors.go
- errors_parse.go
- fields.go
- headers.go
- interface.go
- jobs.go
- locator.go
- messages.go
- paginate.go
- params.go
- permissions.go
- pipelines.go
- pkce.go
- pools.go
- probe.go
- projects.go
- retry.go
- ssh_keys.go
- tls.go
- types.go
- users.go
- vcs_roots.go