api

package
v3.1.12+incompatible Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 29, 2020 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CommitsPage

func CommitsPage(
	qc QueryContext,
	repo Repo, branchName string,
	queryParams string) (pi PageInfo, res []CommitAuthor, rerr error)

func EnterpriseVersion

func EnterpriseVersion(qc QueryContext, apiURL string) (version string, rerr error)

EnterpriseVersion returns the major version of enterprise install. Since there is not endpoint for getting the actual version, we rely on the fact that when you make an unauthenticated request the api return link to docs with version in the url.

func PREditBody

func PREditBody(qc QueryContext, id, body string) error

func PREditTitle

func PREditTitle(qc QueryContext, id, title string) error

func PaginateCommits

func PaginateCommits(lastProcessed time.Time, fn PaginateCommitsFn) error

PaginateCommits is pagination for commit history which supports since argument.

func PaginateNewerThan

func PaginateNewerThan(lastProcessed time.Time, fn PaginateNewerThanFn) error

PaginateNewerThan is pagination for resources supporting orderBy UPDATED_AT field.

func PaginateRegular

func PaginateRegular(fn PaginateRegularFn) error

func PaginateRegularWithPageSize

func PaginateRegularWithPageSize(pageSize int, fn PaginateRegularFn) error

func PaginateV3

func PaginateV3(fn PaginateV3Fn) error

func PullRequestComment

func PullRequestComment(qc QueryContext, commentNodeID string) (res *sourcecode.PullRequestComment, rerr error)

func PullRequestsPage

func PullRequestsPage(
	qc QueryContext,
	repoRefID string,
	queryParams string, stopOnUpdatedAt time.Time) (pi PageInfo, res []PullRequest, totalCount int, rerr error)

func ReposAll

func ReposAll(qc QueryContext, org Org, res chan []Repo) error

func ReposForOnboardAll

func ReposForOnboardAll(qc QueryContext, org Org) (res []*agent.RepoResponseRepos, _ error)

func ReposPageInternal

func ReposPageInternal(qc QueryContext, org Org, queryParams string) (pi PageInfo, repos []Repo, _ error)

func TokenScopes

func TokenScopes(qc QueryContext) (scopes []string, rerr error)

func User

func User(qc QueryContext, login string, orgMember bool) (
	user *sourcecode.User, _ error)

func UsersAll

func UsersAll(qc QueryContext, org Org, resChan chan []*sourcecode.User) error

func UsersEnterpriseAll

func UsersEnterpriseAll(qc QueryContext, resChan chan []*sourcecode.User) error

Types

type CommitAuthor

type CommitAuthor struct {
	CommitHash     string
	AuthorName     string
	AuthorEmail    string
	AuthorRefID    string
	CommitterName  string
	CommitterEmail string
	CommitterRefID string
}

type IDs

type IDs []string

type Org

type Org struct {
	Login string
}

Org contains the data needed for exporting other resources depending on it

func OrgsAll

func OrgsAll(qc QueryContext) (res []Org, rerr error)

func OrgsEnterpriseAll

func OrgsEnterpriseAll(qc QueryContext) (res []Org, rerr error)

func OrgsEnterprisePage

func OrgsEnterprisePage(qc QueryContext, u string) (res []Org, header http.Header, rerr error)

type PageInfo

type PageInfo struct {
	HasNextPage     bool   `json:"hasNextPage"`
	EndCursor       string `json:"endCursor"`
	HasPreviousPage bool   `json:"hasPreviousPage"`
	StartCursor     string `json:"startCursor"`
}

func PullRequestCommentsPage

func PullRequestCommentsPage(
	qc QueryContext,
	pullRequestRefID string,
	queryParams string) (pi PageInfo, res []*sourcecode.PullRequestComment, totalCount int, rerr error)

func PullRequestCommitsPage

func PullRequestCommitsPage(
	qc QueryContext,
	pullRequestRefID string,
	queryParams string) (pi PageInfo, res []*sourcecode.PullRequestCommit, rerr error)

func PullRequestReviewTimelineItemsPage

func PullRequestReviewTimelineItemsPage(
	qc QueryContext,
	repo Repo,
	pullRequestRefID string,
	queryParams string) (pi PageInfo, res []*sourcecode.PullRequestReview, totalCount int, rerr error)

func ReposForOnboardPage

func ReposForOnboardPage(qc QueryContext, org Org, queryParams string, stopOnUpdatedAt time.Time) (pi PageInfo, repos []*agent.RepoResponseRepos, _ error)

func ReposPage

func ReposPage(qc QueryContext, org Org, queryParams string, stopOnUpdatedAt time.Time) (pi PageInfo, repos []*sourcecode.Repo, totalCount int, rerr error)

func UsersEnterprisePage

func UsersEnterprisePage(qc QueryContext, queryParams string) (pi PageInfo, users []*sourcecode.User, _ error)

func UsersPage

func UsersPage(qc QueryContext, org Org, queryParams string) (pi PageInfo, users []*sourcecode.User, _ error)

type PaginateCommitsFn

type PaginateCommitsFn func(query string) (PageInfo, error)

type PaginateNewerThanFn

type PaginateNewerThanFn func(query string, stopOnUpdatedAt time.Time) (PageInfo, error)

type PaginateRegularFn

type PaginateRegularFn func(query string) (PageInfo, error)

type PaginateV3Fn

type PaginateV3Fn func(u string) (responseHeaders http.Header, _ error)

type PullRequest

type PullRequest struct {
	*sourcecode.PullRequest
	HasComments   bool
	HasReviews    bool
	LastCommitSHA string
}

func PullRequestByID

func PullRequestByID(qc QueryContext, refID string) (_ PullRequest, rerr error)

type QueryContext

type QueryContext struct {
	Logger hclog.Logger

	Request func(query string, vars map[string]interface{}, res interface{}) error

	APIURL  string
	APIURL3 string

	CustomerID string
	RefType    string

	UserLoginToRefID           func(login string) (refID string, _ error)
	UserLoginToRefIDFromCommit func(logger hclog.Logger, login, name, email string) (refID string, _ error)

	IsEnterprise func() bool

	Clients reqstats.Clients

	AuthToken string
}

func (QueryContext) BranchID

func (s QueryContext) BranchID(repoID, branchName, firstCommitSHA string) string

func (QueryContext) PullRequestID

func (s QueryContext) PullRequestID(repoID, refID string) string

func (QueryContext) RepoID

func (s QueryContext) RepoID(refID string) string

func (QueryContext) UserID

func (s QueryContext) UserID(refID string) string

func (QueryContext) WithLogger

func (s QueryContext) WithLogger(logger hclog.Logger) QueryContext

type Repo

type Repo struct {
	ID            string
	NameWithOwner string
	// DefaultBranch of the repo, could be empty if no commits yet. Used for getting commit_users
	DefaultBranch string
}

Repo contains the data needed for exporting other resources depending on it

func ReposAllSlice

func ReposAllSlice(qc QueryContext, org Org) (sl []Repo, rerr error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL