Documentation
¶
Index ¶
- type Authenticator
- type AzureDevOpsClient
- func (c *AzureDevOpsClient) GetProject(ctx context.Context, projectName string) (*Project, error)
- func (c *AzureDevOpsClient) GetProjects(ctx context.Context) ([]Project, error)
- func (c *AzureDevOpsClient) GetPullRequestClient() PullRequestClient
- func (c *AzureDevOpsClient) GetRepositoryClient() RepositoryClient
- func (c *AzureDevOpsClient) GetWorkItemClient() WorkItemClient
- func (c *AzureDevOpsClient) ValidateConnection(ctx context.Context) error
- type ChangeDetails
- type ChangeItem
- type ChangeSummary
- type ChangeType
- type ClientFactory
- type CommentPosition
- type CommentType
- type ConnectionConfig
- type DetailedChange
- type DiffContent
- type FileChangeSummary
- type FileDiff
- type GitChange
- type GitCommitRef
- type GitRef
- type GitRepository
- type GitUserDate
- type IdentityRef
- type IterationChangeEntry
- type IterationChangesResponse
- type IterationRef
- type JsonPatchOperation
- type LinkRef
- type PRSummary
- type PersonalAccessTokenAuth
- type Project
- type ProjectRef
- type ProjectsResponse
- type PullRequest
- type PullRequestClient
- type PullRequestComment
- type PullRequestDiff
- type PullRequestIteration
- type PullRequestStatus
- type PullRequestThread
- type PullRequestThreadSummary
- type RateLimiter
- type Reaction
- type RepositoryClient
- type RepositoryRef
- type Reviewer
- type SuggestedChange
- type ThreadComment
- type ThreadContext
- type ThreadStatus
- type ThreadType
- type TrackingCriteria
- type WiqlColumnRef
- type WiqlQueryResult
- type WiqlWorkItemRef
- type WorkItem
- type WorkItemClient
- type WorkItemComment
- type WorkItemCommentsResponse
- type WorkItemFields
- type WorkItemFilters
- type WorkItemRelation
- type WorkItemStateTransition
- type WorkItemTypeInfo
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Authenticator ¶
type AzureDevOpsClient ¶
type AzureDevOpsClient struct {
Config ConnectionConfig
RateLimiter *RateLimiter
// contains filtered or unexported fields
}
func NewAzureDevOpsClient ¶
func NewAzureDevOpsClient(config ConnectionConfig) (*AzureDevOpsClient, error)
func (*AzureDevOpsClient) GetProject ¶
func (*AzureDevOpsClient) GetProjects ¶
func (c *AzureDevOpsClient) GetProjects(ctx context.Context) ([]Project, error)
func (*AzureDevOpsClient) GetPullRequestClient ¶
func (c *AzureDevOpsClient) GetPullRequestClient() PullRequestClient
func (*AzureDevOpsClient) GetRepositoryClient ¶ added in v0.2.1
func (c *AzureDevOpsClient) GetRepositoryClient() RepositoryClient
func (*AzureDevOpsClient) GetWorkItemClient ¶
func (c *AzureDevOpsClient) GetWorkItemClient() WorkItemClient
func (*AzureDevOpsClient) ValidateConnection ¶
func (c *AzureDevOpsClient) ValidateConnection(ctx context.Context) error
type ChangeDetails ¶
type ChangeDetails struct {
Path string `json:"path"`
ChangeType ChangeType `json:"changeType"`
AddedLines int `json:"addedLines"`
RemovedLines int `json:"removedLines"`
Content *struct {
OriginalContent *string `json:"originalContent,omitempty"`
NewContent *string `json:"newContent,omitempty"`
Diff *string `json:"diff,omitempty"`
} `json:"content,omitempty"`
}
type ChangeItem ¶ added in v0.2.4
type ChangeSummary ¶
type ChangeType ¶
type ChangeType string
const ( ChangeTypeAdd ChangeType = "add" ChangeTypeEdit ChangeType = "edit" ChangeTypeDelete ChangeType = "delete" ChangeTypeRename ChangeType = "rename" ChangeTypePerm ChangeType = "permission" )
type ClientFactory ¶
type ClientFactory struct {
// contains filtered or unexported fields
}
func GetClientFactory ¶
func GetClientFactory() *ClientFactory
func InitClientFactory ¶
func InitClientFactory() *ClientFactory
func (*ClientFactory) ClearClients ¶
func (f *ClientFactory) ClearClients()
func (*ClientFactory) GetClient ¶
func (f *ClientFactory) GetClient(org, project, token string) (*AzureDevOpsClient, error)
type CommentPosition ¶
type CommentType ¶
type CommentType string
const ( CommentTypeText CommentType = "text" CommentTypeSuggestion CommentType = "suggestion" )
type ConnectionConfig ¶
func NewConnectionConfig ¶
func NewConnectionConfig(organization, project, token string) ConnectionConfig
type DetailedChange ¶
type DetailedChange struct {
ChangeID int `json:"changeId"`
ItemID string `json:"itemId"`
Path string `json:"path"`
OriginalPath *string `json:"originalPath,omitempty"`
ChangeType ChangeType `json:"changeType"`
AddedLines int `json:"addedLines"`
RemovedLines int `json:"removedLines"`
IsBinary bool `json:"isBinary"`
IsTruncated bool `json:"isTruncated"`
Diff *DiffContent `json:"diff,omitempty"`
SourceVersion *string `json:"sourceVersion,omitempty"`
TargetVersion *string `json:"targetVersion,omitempty"`
}
type DiffContent ¶
type FileChangeSummary ¶
type FileDiff ¶ added in v0.2.5
type FileDiff struct {
Path string `json:"path"`
ChangeType string `json:"changeType"`
OriginalPath string `json:"originalPath,omitempty"`
Diff string `json:"diff,omitempty"`
Additions int `json:"additions"`
Deletions int `json:"deletions"`
IsBinary bool `json:"isBinary"`
IsTooLarge bool `json:"isTooLarge,omitempty"`
}
type GitChange ¶
type GitChange struct {
ChangeID int `json:"changeId"`
ItemID string `json:"itemId"`
Path string `json:"path"`
OriginalPath *string `json:"originalPath,omitempty"`
ChangeType ChangeType `json:"changeType"`
SourceServerItem *string `json:"sourceServerItem,omitempty"`
TargetServerItem *string `json:"targetServerItem,omitempty"`
SourceVersion *string `json:"sourceVersion,omitempty"`
TargetVersion *string `json:"targetVersion,omitempty"`
SourceEncoding *string `json:"sourceEncoding,omitempty"`
TargetEncoding *string `json:"targetEncoding,omitempty"`
Links map[string]LinkRef `json:"_links,omitempty"`
}
type GitCommitRef ¶
type GitCommitRef struct {
CommitID string `json:"commitId"`
URL string `json:"url,omitempty"`
Author *GitUserDate `json:"author,omitempty"`
Comment string `json:"comment,omitempty"`
}
type GitRepository ¶ added in v0.2.1
type GitRepository struct {
ID string `json:"id"`
Name string `json:"name"`
URL string `json:"url"`
RemoteURL string `json:"remoteUrl,omitempty"`
SSHURL string `json:"sshUrl,omitempty"`
WebURL string `json:"webUrl,omitempty"`
DefaultBranch string `json:"defaultBranch,omitempty"`
Project *ProjectRef `json:"project,omitempty"`
Size int64 `json:"size,omitempty"`
}
type GitUserDate ¶
type IdentityRef ¶
type IterationChangeEntry ¶
type IterationChangeEntry struct {
ChangeID int `json:"changeId"`
Item *ChangeItem `json:"item,omitempty"`
ItemID string `json:"itemId"`
Path string `json:"path"`
OriginalPath *string `json:"originalPath,omitempty"`
ChangeType ChangeType `json:"changeType"`
SourceServerItem *string `json:"sourceServerItem,omitempty"`
TargetServerItem *string `json:"targetServerItem,omitempty"`
SourceVersion *string `json:"sourceVersion,omitempty"`
TargetVersion *string `json:"targetVersion,omitempty"`
SourceEncoding *string `json:"sourceEncoding,omitempty"`
TargetEncoding *string `json:"targetEncoding,omitempty"`
IsBinary *bool `json:"isBinary,omitempty"`
Content *struct {
OriginalContent *string `json:"originalContent,omitempty"`
NewContent *string `json:"newContent,omitempty"`
} `json:"content,omitempty"`
URL *string `json:"url,omitempty"`
Links map[string]LinkRef `json:"_links,omitempty"`
}
type IterationChangesResponse ¶
type IterationChangesResponse struct {
ChangeEntries []IterationChangeEntry `json:"changeEntries"`
CommonAncestorCommit *string `json:"commonAncestorCommit,omitempty"`
CommonAncestorCommitID *string `json:"commonAncestorCommitId,omitempty"`
BaseIteration *IterationRef `json:"baseIteration,omitempty"`
TargetIteration *IterationRef `json:"targetIteration,omitempty"`
HasMoreChanges *bool `json:"hasMoreChanges,omitempty"`
}
type IterationRef ¶
type JsonPatchOperation ¶
type PRSummary ¶
type PRSummary struct {
PullRequestID int `json:"pullRequestId"`
Title string `json:"title"`
Status string `json:"status"`
SourceBranch string `json:"sourceBranch"`
TargetBranch string `json:"targetBranch"`
TotalChanges int `json:"totalChanges"`
Files []FileChangeSummary `json:"files"`
Summary ChangeSummary `json:"summary"`
}
type PersonalAccessTokenAuth ¶
type PersonalAccessTokenAuth struct {
Token string
}
func NewPersonalAccessTokenAuth ¶
func NewPersonalAccessTokenAuth(token string) *PersonalAccessTokenAuth
func (*PersonalAccessTokenAuth) Authenticate ¶
type ProjectRef ¶
type ProjectsResponse ¶
type PullRequest ¶
type PullRequest struct {
PullRequestID int `json:"pullRequestId"`
CodeReviewID *int `json:"codeReviewId,omitempty"`
Status PullRequestStatus `json:"status"`
CreatedBy *IdentityRef `json:"createdBy,omitempty"`
CreationDate *string `json:"creationDate,omitempty"`
Title string `json:"title"`
Description *string `json:"description,omitempty"`
SourceRefName *string `json:"sourceRefName,omitempty"`
TargetRefName *string `json:"targetRefName,omitempty"`
MergeStatus *string `json:"mergeStatus,omitempty"`
IsDraft *bool `json:"isDraft,omitempty"`
MergeID *string `json:"mergeId,omitempty"`
LastMergeSourceCommit *GitCommitRef `json:"lastMergeSourceCommit,omitempty"`
LastMergeTargetCommit *GitCommitRef `json:"lastMergeTargetCommit,omitempty"`
LastMergeCommit *GitCommitRef `json:"lastMergeCommit,omitempty"`
Reviewers []Reviewer `json:"reviewers,omitempty"`
URL *string `json:"url,omitempty"`
SupportsIterations *bool `json:"supportsIterations,omitempty"`
Repository *RepositoryRef `json:"repository,omitempty"`
Links map[string]LinkRef `json:"_links,omitempty"`
}
type PullRequestClient ¶
type PullRequestClient interface {
ListPullRequests(ctx context.Context, project, repo string, status PullRequestStatus) ([]PullRequest, error)
GetPullRequest(ctx context.Context, project, repo string, prID int) (*PullRequest, error)
GetPullRequestChanges(ctx context.Context, project, repo string, prID int) ([]GitChange, error)
GetPullRequestIterations(ctx context.Context, project, repo string, prID int) ([]PullRequestIteration, error)
GetIterationChanges(ctx context.Context, project, repo string, prID, iterationID int) ([]GitChange, error)
GetThreads(ctx context.Context, project, repo string, prID int) ([]PullRequestThreadSummary, error)
CreateThread(ctx context.Context, project, repo string, prID int, thread *PullRequestThread) (*PullRequestThread, error)
PostComment(ctx context.Context, project, repo string, prID, threadID int, comment string) (*PullRequestComment, error)
GetPullRequestSummary(ctx context.Context, project, repo string, prID int) (*PRSummary, error)
GetPullRequestDiff(ctx context.Context, project, repo string, prID int, maxFiles int) (*PullRequestDiff, error)
VoteReviewer(ctx context.Context, project, repo string, prID int, userID string, vote int) error
}
func GetPullRequestClient ¶
func GetPullRequestClient(ctx context.Context, organization, project, token string) (PullRequestClient, error)
func NewPullRequestClient ¶
func NewPullRequestClient(client *AzureDevOpsClient) PullRequestClient
type PullRequestComment ¶
type PullRequestComment struct {
ID int `json:"id"`
Content string `json:"content"`
CommentType CommentType `json:"commentType"`
Author *IdentityRef `json:"author,omitempty"`
CreatedDate string `json:"createdDate"`
ModifiedDate *string `json:"modifiedDate,omitempty"`
IsDeleted *bool `json:"isDeleted,omitempty"`
ParentCommentID *int `json:"parentCommentId,omitempty"`
}
type PullRequestDiff ¶ added in v0.2.5
type PullRequestDiff struct {
PullRequestID int `json:"pullRequestId"`
Title string `json:"title"`
SourceBranch string `json:"sourceBranch"`
TargetBranch string `json:"targetBranch"`
Files []FileDiff `json:"files"`
TotalAdditions int `json:"totalAdditions"`
TotalDeletions int `json:"totalDeletions"`
TotalFiles int `json:"totalFiles"`
}
type PullRequestIteration ¶
type PullRequestIteration struct {
ID int `json:"id"`
FirstCommitID *string `json:"firstCommitId,omitempty"`
LastCommitID *string `json:"lastCommitId,omitempty"`
Author *IdentityRef `json:"author,omitempty"`
CreatedDate *string `json:"createdDate,omitempty"`
Description *string `json:"description,omitempty"`
SourceRefCommit *GitRef `json:"sourceRefCommit,omitempty"`
TargetRefCommit *GitRef `json:"targetRefCommit,omitempty"`
HasMoreChanges *bool `json:"hasMoreChanges,omitempty"`
}
type PullRequestStatus ¶
type PullRequestStatus string
const ( PullRequestStatusActive PullRequestStatus = "active" PullRequestStatusAbandoned PullRequestStatus = "abandoned" PullRequestStatusCompleted PullRequestStatus = "completed" PullRequestStatusNotSet PullRequestStatus = "notSet" PullRequestStatusAll PullRequestStatus = "all" )
type PullRequestThread ¶
type PullRequestThread struct {
ID int `json:"id,omitempty"`
Status *ThreadStatus `json:"status,omitempty"`
ThreadContext *ThreadContext `json:"threadContext,omitempty"`
Comments []ThreadComment `json:"comments"`
IsDeleted *bool `json:"isDeleted,omitempty"`
ThreadType *ThreadType `json:"threadType,omitempty"`
Links map[string]LinkRef `json:"_links,omitempty"`
SuggestedChanges []SuggestedChange `json:"suggestedChanges,omitempty"`
}
type RateLimiter ¶
type RateLimiter struct {
// contains filtered or unexported fields
}
func NewRateLimiter ¶
func NewRateLimiter(maxTokens float64, refillRate float64) *RateLimiter
func (*RateLimiter) Acquire ¶
func (r *RateLimiter) Acquire(tokens float64) bool
func (*RateLimiter) WaitForToken ¶
func (r *RateLimiter) WaitForToken(ctx context.Context, tokens float64) error
type RepositoryClient ¶ added in v0.2.1
type RepositoryClient interface {
ListRepositories(ctx context.Context, project string) ([]GitRepository, error)
GetRepository(ctx context.Context, project, repoName string) (*GitRepository, error)
}
func GetRepositoryClient ¶ added in v0.2.1
func GetRepositoryClient(ctx context.Context, organization, project, token string) (RepositoryClient, error)
func NewRepositoryClient ¶ added in v0.2.1
func NewRepositoryClient(client *AzureDevOpsClient) RepositoryClient
type RepositoryRef ¶
type RepositoryRef struct {
ID string `json:"id"`
Name string `json:"name"`
URL string `json:"url"`
Project *ProjectRef `json:"project,omitempty"`
}
type Reviewer ¶
type Reviewer struct {
ReviewerURL *string `json:"reviewerUrl,omitempty"`
Vote int `json:"vote"`
VotedBy *IdentityRef `json:"votedBy,omitempty"`
IsRequired *bool `json:"isRequired,omitempty"`
}
type SuggestedChange ¶
type ThreadComment ¶
type ThreadComment struct {
ID *int `json:"id,omitempty"`
Content string `json:"content"`
CommentType *CommentType `json:"commentType,omitempty"`
Author *IdentityRef `json:"author,omitempty"`
CreatedDate *string `json:"createdDate,omitempty"`
ModifiedDate *string `json:"modifiedDate,omitempty"`
IsDeleted *bool `json:"isDeleted,omitempty"`
ParentCommentID *int `json:"parentCommentId,omitempty"`
Reactions []Reaction `json:"reactions,omitempty"`
Likes []IdentityRef `json:"likes,omitempty"`
}
type ThreadContext ¶
type ThreadContext struct {
FilePath *string `json:"filePath,omitempty"`
RightFileStart *CommentPosition `json:"rightFileStart,omitempty"`
RightFileEnd *CommentPosition `json:"rightFileEnd,omitempty"`
LeftFileStart *CommentPosition `json:"leftFileStart,omitempty"`
LeftFileEnd *CommentPosition `json:"leftFileEnd,omitempty"`
TrackingCriteria *TrackingCriteria `json:"trackingCriteria,omitempty"`
}
type ThreadStatus ¶
type ThreadStatus string
const ( ThreadStatusActive ThreadStatus = "active" ThreadStatusFixed ThreadStatus = "fixed" ThreadStatusWontFix ThreadStatus = "wontFix" ThreadStatusClosed ThreadStatus = "closed" ThreadStatusPending ThreadStatus = "pending" )
type ThreadType ¶
type ThreadType string
const ( ThreadTypeBug ThreadType = "bug" ThreadTypeIssue ThreadType = "issue" ThreadTypeQuestion ThreadType = "question" ThreadTypeGeneral ThreadType = "general" )
type TrackingCriteria ¶
type WiqlColumnRef ¶
type WiqlQueryResult ¶
type WiqlQueryResult struct {
QueryResultType string `json:"queryResultType"`
WorkItems []WiqlWorkItemRef `json:"workItems"`
Columns []WiqlColumnRef `json:"columns"`
}
type WiqlWorkItemRef ¶
type WorkItem ¶
type WorkItem struct {
ID int `json:"id"`
Rev int `json:"rev"`
Fields WorkItemFields `json:"fields"`
Relations []WorkItemRelation `json:"relations,omitempty"`
Links map[string]LinkRef `json:"_links,omitempty"`
URL string `json:"url"`
}
type WorkItemClient ¶
type WorkItemClient interface {
GetWorkItem(ctx context.Context, project string, id int, expand *bool) (*WorkItem, error)
ListWorkItems(ctx context.Context, project string, filters WorkItemFilters) ([]WorkItem, error)
CreateWorkItem(ctx context.Context, project string, workItemType string, fields map[string]interface{}) (*WorkItem, error)
UpdateWorkItem(ctx context.Context, project string, id int, updates []map[string]interface{}) (*WorkItem, error)
GetComments(ctx context.Context, project string, workItemID int) ([]WorkItemComment, error)
AddComment(ctx context.Context, project string, workItemID int, text string) (*WorkItemComment, error)
QueryByWiql(ctx context.Context, project string, wiqlQuery string, limit int) ([]WorkItem, error)
GetWorkItemsBatch(ctx context.Context, project string, ids []int) ([]WorkItem, error)
GetValidStates(ctx context.Context, project string, workItemID int) ([]string, error)
}
func GetWorkItemClient ¶
func GetWorkItemClient(ctx context.Context, organization, project, token string) (WorkItemClient, error)
func NewWorkItemClient ¶
func NewWorkItemClient(client *AzureDevOpsClient) WorkItemClient
type WorkItemComment ¶
type WorkItemComment struct {
WorkItemID int `json:"workItemId,omitempty"`
CommentId int `json:"commentId,omitempty"`
Text string `json:"text"`
CreatedDate string `json:"createdDate,omitempty"`
CreatedBy *IdentityRef `json:"createdBy,omitempty"`
ModifiedDate string `json:"modifiedDate,omitempty"`
ModifiedBy *IdentityRef `json:"modifiedBy,omitempty"`
Version int `json:"version,omitempty"`
IsDeleted bool `json:"isDeleted,omitempty"`
URL string `json:"url,omitempty"`
}
type WorkItemCommentsResponse ¶
type WorkItemCommentsResponse struct {
Count int `json:"count"`
Comments []WorkItemComment `json:"comments"`
TotalCount int `json:"totalCount"`
ContinuationToken string `json:"continuationToken,omitempty"`
NextPage string `json:"nextPage,omitempty"`
}
type WorkItemFields ¶
type WorkItemFields map[string]interface{}
type WorkItemFilters ¶
type WorkItemRelation ¶
type WorkItemStateTransition ¶
type WorkItemTypeInfo ¶
type WorkItemTypeInfo struct {
Name string `json:"name"`
States []string `json:"states"`
Transitions []WorkItemStateTransition `json:"transitions,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.