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: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CommitStats

func CommitStats(qc QueryContext, repoID string, commitID string) (adds, dels int64, err error)

func GroupsAll

func GroupsAll(qc QueryContext) (groupNames []string, err error)

GroupsAll all groups

func PaginateNewerThan

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

func PaginateStartAt

func PaginateStartAt(log hclog.Logger, fn PaginateStartAtFn) error

func PullRequestPage

func PullRequestPage(
	qc QueryContext,
	repoRefID string,
	params url.Values,
	stopOnUpdatedAt time.Time) (pi PageInfo, res []PullRequest, err error)

func ReposAll

func ReposAll(qc interface{}, groupName string, res chan []commonrepo.Repo) error

ReposAll get all group repos available

func ServerVersion

func ServerVersion(qc QueryContext) (serverVersion string, err error)

func UserEmails

func UserEmails(qc QueryContext, userID int64) (emails []string, err error)

func UsersPage

func UsersPage(qc QueryContext, params url.Values) (page PageInfo, users []User, err error)

func ValidateUser

func ValidateUser(qc QueryContext) (err error)

Types

type PageInfo

type PageInfo struct {
	PageSize   int
	NextPage   string
	Page       string
	TotalPages string
	Total      int
}

PageInfo page info

func PullRequestCommentsPage

func PullRequestCommentsPage(
	qc QueryContext,
	repo commonrepo.Repo,
	pr PullRequest,
	params url.Values) (pi PageInfo, res []*sourcecode.PullRequestComment, err error)

func PullRequestCommitsPage

func PullRequestCommitsPage(
	qc QueryContext,
	repo commonrepo.Repo,
	prID string,
	prIID string,
	params url.Values) (pi PageInfo, res []*sourcecode.PullRequestCommit, err error)

func PullRequestReviewsPage

func PullRequestReviewsPage(
	qc QueryContext,
	repo commonrepo.Repo,
	pr PullRequest,
	params url.Values) (pi PageInfo, res []*sourcecode.PullRequestReview, err error)

func RepoUsersPageREST

func RepoUsersPageREST(qc QueryContext, repo commonrepo.Repo, params url.Values) (page PageInfo, repos []*sourcecode.User, err error)

func ReposOnboardPage

func ReposOnboardPage(qc QueryContext, groupName string, params url.Values) (page PageInfo, repos []*agent.RepoResponseRepos, err error)

ReposOnboardPage get repositories page for onboard

func ReposPage

func ReposPage(qc QueryContext, groupName string, params url.Values, stopOnUpdatedAt time.Time) (page PageInfo, repos []*sourcecode.Repo, err error)

ReposPage get repositories page after stopOnUpdatedAt

func ReposPageCommon

func ReposPageCommon(qc QueryContext, groupName string, params url.Values) (page PageInfo, repos []commonrepo.Repo, err error)

ReposPageCommon get common info repos page

type PaginateNewerThanFn

type PaginateNewerThanFn func(log hclog.Logger, parameters url.Values, stopOnUpdatedAt time.Time) (PageInfo, error)

type PaginateStartAtFn

type PaginateStartAtFn func(log hclog.Logger, paginationParams url.Values) (page PageInfo, _ error)

type PullRequest

type PullRequest struct {
	*sourcecode.PullRequest
	IID           string
	LastCommitSHA string
}

type QueryContext

type QueryContext struct {
	BaseURL string
	Logger  hclog.Logger
	Request func(url string, params url.Values, response interface{}) (PageInfo, error)

	CustomerID string
	RefType    string

	UserEmailMap map[string]string
	IDs          ids2.Gen
	Re           *RequesterOpts
}

QueryContext query context

type Requester

type Requester struct {
	// contains filtered or unexported fields
}

Requester requester

func NewRequester

func NewRequester(opts RequesterOpts) *Requester

NewRequester new requester

func (*Requester) MakeRequest

func (e *Requester) MakeRequest(url string, params url.Values, response interface{}) (pi PageInfo, err error)

MakeRequest make request

type RequesterOpts

type RequesterOpts struct {
	Logger             hclog.Logger
	APIURL             string
	APIKey             string
	AccessToken        string
	InsecureSkipVerify bool
	ServerType         ServerType
	Concurrency        chan bool
	Client             *http.Client
	Agent              rpcdef.Agent
}

RequesterOpts requester opts

type ServerType

type ServerType string

ServerType server type

const (
	// CLOUD server type
	CLOUD ServerType = "cloud"
	// ON_PREMISE server type
	ON_PREMISE ServerType = "on-premise"
)

type User

type User struct {
	ID        int64
	Email     string
	Username  string
	Name      string
	AvatarURL string
	URL       string
}

Jump to

Keyboard shortcuts

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