Documentation
¶
Overview ¶
Atlassian Stash API package. Stash API Reference: https://developer.atlassian.com/static/rest/stash/3.0.1/stash-rest.html
Index ¶
- Variables
- func IsRepositoryExists(err error) bool
- func IsRepositoryNotFound(err error) bool
- type Branch
- type BranchPermission
- type BranchRestriction
- type BranchRestrictions
- type Branches
- type Client
- func (client Client) CreateBranchRestriction(projectKey, repositorySlug, branch, user string) (BranchRestriction, error)
- func (client Client) CreateComment(projectKey, repositorySlug, pullRequest, text string) (Comment, error)
- func (client Client) CreatePullRequest(projectKey, repositorySlug, title, description, fromRef, toRef string, ...) (PullRequest, error)
- func (client Client) CreateRepository(projectKey, projectSlug string) (Repository, error)
- func (client Client) DeleteBranch(projectKey, repositorySlug, branchName string) error
- func (client Client) DeleteBranchRestriction(projectKey, repositorySlug string, id int) error
- func (client Client) GetBranchRestrictions(projectKey, repositorySlug string) (BranchRestrictions, error)
- func (client Client) GetBranches(projectKey, repositorySlug string) (map[string]Branch, error)
- func (client Client) GetCommit(projectKey, repositorySlug, commitHash string) (Commit, error)
- func (client Client) GetCommits(projectKey, repositorySlug, commitSinceHash string, commitUntilHash string) (Commits, error)
- func (client Client) GetPullRequest(projectKey, projectSlug, identifier string) (PullRequest, error)
- func (client Client) GetPullRequests(projectKey, projectSlug, state string) ([]PullRequest, error)
- func (client Client) GetRawFile(repositoryProjectKey, repositorySlug, filePath, branch string) ([]byte, error)
- func (client Client) GetRepositories() (map[int]Repository, error)
- func (client Client) GetRepository(projectKey, repositorySlug string) (Repository, error)
- func (client Client) GetTags(projectKey, repositorySlug string) (map[string]Tag, error)
- func (client Client) UpdatePullRequest(projectKey, repositorySlug, identifier string, version int, ...) (PullRequest, error)
- type Clone
- type Comment
- type CommentResource
- type Commit
- type Commits
- type Links
- type Page
- type Project
- type PullRequest
- type PullRequestProject
- type PullRequestRef
- type PullRequestRepository
- type PullRequestResource
- type PullRequests
- type Ref
- type Repositories
- type Repository
- type Reviewer
- type Stash
- type Tag
- type Tags
- type User
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func IsRepositoryExists ¶
func IsRepositoryNotFound ¶
Types ¶
type BranchPermission ¶
type BranchRestriction ¶
type BranchRestrictions ¶
type BranchRestrictions struct {
BranchRestriction []BranchRestriction `json:"values"`
}
type Client ¶
type Client struct {
Stash
// contains filtered or unexported fields
}
func (Client) CreateBranchRestriction ¶
func (client Client) CreateBranchRestriction(projectKey, repositorySlug, branch, user string) (BranchRestriction, error)
func (Client) CreateComment ¶
func (client Client) CreateComment(projectKey, repositorySlug, pullRequest, text string) (Comment, error)
CreateComment creates a comment for a pull-request.
func (Client) CreatePullRequest ¶
func (client Client) CreatePullRequest(projectKey, repositorySlug, title, description, fromRef, toRef string, reviewers []string) (PullRequest, error)
CreatePullRequest creates a pull request between branches.
func (Client) CreateRepository ¶
func (client Client) CreateRepository(projectKey, projectSlug string) (Repository, error)
func (Client) DeleteBranch ¶
func (Client) DeleteBranchRestriction ¶
GetRepository returns a repository representation for the given Stash Project key and repository slug.
func (Client) GetBranchRestrictions ¶
func (client Client) GetBranchRestrictions(projectKey, repositorySlug string) (BranchRestrictions, error)
func (Client) GetBranches ¶
GetBranches returns a map of branches indexed by branch display name for the given repository.
func (Client) GetCommits ¶
func (client Client) GetCommits(projectKey, repositorySlug, commitSinceHash string, commitUntilHash string) (Commits, error)
GetCommits returns the commits between two hashes, inclusively.
func (Client) GetPullRequest ¶
func (client Client) GetPullRequest(projectKey, projectSlug, identifier string) (PullRequest, error)
GetPullRequest returns a pull request for a project/slug with specified identifier.
func (Client) GetPullRequests ¶
func (client Client) GetPullRequests(projectKey, projectSlug, state string) ([]PullRequest, error)
GetPullRequests returns a list of pull requests for a project / slug.
func (Client) GetRawFile ¶
func (Client) GetRepositories ¶
func (client Client) GetRepositories() (map[int]Repository, error)
GetRepositories returns a map of repositories indexed by repository URL.
func (Client) GetRepository ¶
func (client Client) GetRepository(projectKey, repositorySlug string) (Repository, error)
GetRepository returns a repository representation for the given Stash Project key and repository slug.
func (Client) GetTags ¶
GetTags returns a map of tags indexed by tag display name for the given repository.
func (Client) UpdatePullRequest ¶
func (client Client) UpdatePullRequest(projectKey, repositorySlug, identifier string, version int, title, description, toRef string, reviewers []string) (PullRequest, error)
UpdatePullRequest update a pull request.
type CommentResource ¶
type CommentResource struct {
Text string `json:"text"`
}
type Commit ¶
type Commit struct {
ID string `json:"id"`
DisplayID string `json:"displayId"`
Author struct {
Name string `json:"name"`
EmailAddress string `json:"emailAddress"`
} `json:"author"`
AuthorTimestamp int64 `json:"authorTimestamp"` // in milliseconds since the epoch
Attributes struct {
JiraKeys []string `json:"jira-key"`
} `json:"attributes"`
}
type PullRequest ¶
type PullRequest struct {
ID int `id:"closed"`
Version int `json:"version"`
Closed bool `json:"closed"`
Open bool `json:"open"`
State string `json:"state"`
Title string `json:"title"`
Description string `json:"description"`
FromRef Ref `json:"fromRef"`
ToRef Ref `json:"toRef"`
CreatedDate int64 `json:"createdDate"`
UpdatedDate int64 `json:"updatedDate"`
Reviewers []Reviewer `json:"reviewers"`
}
type PullRequestProject ¶
type PullRequestProject struct {
Key string `json:"key"`
}
type PullRequestRef ¶
type PullRequestRef struct {
Id string `json:"id"`
Repository PullRequestRepository `json:"repository"`
}
type PullRequestRepository ¶
type PullRequestRepository struct {
Slug string `json:"slug"`
Name string `json:"name,omitempty"`
Project PullRequestProject `json:"project"`
}
type PullRequestResource ¶
type PullRequestResource struct {
Version int `json:"version,omitempty"`
Title string `json:"title,omitempty"`
Description string `json:"description,omitempty"`
// FromRef and ToRef should be PullRequestRef but there is interface{}
// for omitting empty values. encoding/json can't handle empty structs
// and omit them.
FromRef interface{} `json:"fromRef,omitempty"`
ToRef interface{} `json:"toRef,omitempty"`
Reviewers []Reviewer `json:"reviewers,omitempty"`
}
type PullRequests ¶
type PullRequests struct {
Page
PullRequests []PullRequest `json:"values"`
}
type Repositories ¶
type Repositories struct {
IsLastPage bool `json:"isLastPage"`
Size int `json:"size"`
Start int `json:"start"`
NextPageStart int `json:"nextPageStart"`
Repository []Repository `json:"values"`
}
type Repository ¶
type Repository struct {
ID int `json:"id"`
Name string `json:"name"`
Slug string `json:"slug"`
Project Project `json:"project"`
ScmID string `json:"scmId"`
Links Links `json:"links"`
}
func HasRepository ¶
func HasRepository(repositories map[int]Repository, url string) (Repository, bool)
func (Repository) SshUrl ¶
func (repo Repository) SshUrl() string
SshUrl extracts the SSH-based URL from the repository metadata.
type Stash ¶
type Stash interface {
CreateRepository(projectKey, slug string) (Repository, error)
GetRepositories() (map[int]Repository, error)
GetBranches(projectKey, repositorySlug string) (map[string]Branch, error)
GetTags(projectKey, repositorySlug string) (map[string]Tag, error)
CreateBranchRestriction(projectKey, repositorySlug, branch, user string) (BranchRestriction, error)
GetBranchRestrictions(projectKey, repositorySlug string) (BranchRestrictions, error)
DeleteBranchRestriction(projectKey, repositorySlug string, id int) error
GetRepository(projectKey, repositorySlug string) (Repository, error)
GetPullRequests(projectKey, repositorySlug, state string) ([]PullRequest, error)
GetPullRequest(projectKey, repositorySlug, identifier string) (PullRequest, error)
GetRawFile(projectKey, repositorySlug, branch, filePath string) ([]byte, error)
CreatePullRequest(projectKey, repositorySlug, title, description, fromRef, toRef string, reviewers []string) (PullRequest, error)
UpdatePullRequest(projectKey, repositorySlug, identifier string, version int, title, description, toRef string, reviewers []string) (PullRequest, error)
DeleteBranch(projectKey, repositorySlug, branchName string) error
GetCommit(projectKey, repositorySlug, commitHash string) (Commit, error)
GetCommits(projectKey, repositorySlug, commitSinceHash string, commitUntilHash string) (Commits, error)
CreateComment(projectKey, repositorySlug, pullRequest, text string) (Comment, error)
}