engine

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package engine contains interfaces for different git providers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Github

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

Github implements Interface with github API below it.

func NewGithub

func NewGithub(owner, name, basicAuthUsername, basicAuthPassword string, httpCl http.Client) (*Github, error)

NewGithub makes new instance of Github.

func (*Github) Compare

func (g *Github) Compare(ctx context.Context, fromSHA, toSHA string) (git.CommitsComparison, error)

Compare two commits by their SHA.

func (*Github) GetLastCommitOfBranch

func (g *Github) GetLastCommitOfBranch(ctx context.Context, branchName string) (string, error)

GetLastCommitOfBranch returns the SHA or alias of the last commit in the branch.

func (*Github) HeadCommit

func (g *Github) HeadCommit(_ context.Context) (string, error)

HeadCommit returns the alias of the oldest commit in the repository

func (*Github) ListPRsOfCommit

func (g *Github) ListPRsOfCommit(ctx context.Context, sha string) ([]git.PullRequest, error)

ListPRsOfCommit returns pull requests associated with commit by the given SHA.

func (*Github) ListTags

func (g *Github) ListTags(ctx context.Context) ([]git.Tag, error)

ListTags returns all tags of the repository.

type Gitlab

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

Gitlab implements Interface with gitlab API below it.

func NewGitlab

func NewGitlab(token, baseURL, projectID string, httpCl http.Client) (*Gitlab, error)

NewGitlab creates a new Gitlab engine.

func (*Gitlab) Compare

func (g *Gitlab) Compare(ctx context.Context, fromSHA, toSHA string) (git.CommitsComparison, error)

Compare two commits by their SHA.

func (*Gitlab) GetLastCommitOfBranch

func (g *Gitlab) GetLastCommitOfBranch(ctx context.Context, branchName string) (string, error)

GetLastCommitOfBranch returns the SHA or alias of the last commit in the branch.

func (*Gitlab) HeadCommit

func (g *Gitlab) HeadCommit(_ context.Context) (string, error)

HeadCommit returns the alias of the oldest commit in the repository

func (*Gitlab) ListPRsOfCommit

func (g *Gitlab) ListPRsOfCommit(ctx context.Context, sha string) ([]git.PullRequest, error)

ListPRsOfCommit returns pull requests associated with commit by the given SHA.

func (*Gitlab) ListTags

func (g *Gitlab) ListTags(ctx context.Context) ([]git.Tag, error)

ListTags returns all tags of the repository.

type Interface

type Interface interface {
	// Compare returns comparison between two commits,
	// given by their SHA.
	Compare(ctx context.Context, fromSHA, toSHA string) (git.CommitsComparison, error)
	// ListPRsOfCommit returns pull/merge requests
	// associated with the commit, given by its SHA.
	ListPRsOfCommit(ctx context.Context, sha string) ([]git.PullRequest, error)
	// ListTags returns tags of the repository in descending order of creation.
	ListTags(ctx context.Context) ([]git.Tag, error)
	// HeadCommit returns the SHA or alias of the oldest commit in the repository
	HeadCommit(ctx context.Context) (string, error)
	// GetLastCommitOfBranch returns the SHA or alias of the last commit in the branch.
	GetLastCommitOfBranch(ctx context.Context, branch string) (string, error)
}

Interface defines methods to retrieve information about repository.

Jump to

Keyboard shortcuts

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