gitlabapi

package
v0.0.30 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func APILastCommitsOfPath

func APILastCommitsOfPath(host, id, branch, path string) string

APILastCommitsOfPath GitLab : Last commits of specific branch & specified path API Ref: https://docs.gitlab.com/ee/api/commits.html#list-repository-commits Example: https://gitlab.com/api/v4/projects/nanuchi%2Fdeveloping-with-docker/repository/commits?ref_name=master&path=app/server.js

func APIRepoTree

func APIRepoTree(host, id, branch string) string

APIRepoTree GitLab tree api API Ref: https://docs.gitlab.com/ee/api/repositories.html

Types

type Commit

type Commit struct {
	ID             string    `json:"id"`
	ShortID        string    `json:"short_id"`
	CreatedAt      time.Time `json:"created_at"`
	Title          string    `json:"title"`
	Message        string    `json:"message"`
	AuthorName     string    `json:"author_name"`
	AuthorEmail    string    `json:"author_email"`
	AuthoredDate   time.Time `json:"authored_date"`
	CommitterName  string    `json:"committer_name"`
	CommitterEmail string    `json:"committer_email"`
	CommitterDate  time.Time `json:"committed_date"`
	WebURL         string    `json:"web_url"`
	ParentIDS      []string  `json:"parent_ids"`
}

LatestCommit returned structure

type GitLabAPI

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

func NewGitLabAPI

func NewGitLabAPI(host string) *GitLabAPI

func (*GitLabAPI) GetDefaultBranchName

func (gl *GitLabAPI) GetDefaultBranchName(owner, repo string, headers *Headers) (string, error)

func (*GitLabAPI) GetLatestCommit

func (gl *GitLabAPI) GetLatestCommit(owner, repo, branch string, headers *Headers) (*Commit, error)

func (*GitLabAPI) GetRepoTree

func (gl *GitLabAPI) GetRepoTree(owner, repo, branch string, headers *Headers) (*Tree, error)

type Headers

type Headers struct {
	Token string
}

func (*Headers) ToMap

func (h *Headers) ToMap() map[string]string

ToMap convert headers to map[string]string

type IGitLabAPI

type IGitLabAPI interface {
	GetRepoTree(owner, repo, branch string, headers *Headers) (*Tree, error)
	GetDefaultBranchName(owner, repo string, headers *Headers) (string, error)
	GetLatestCommit(owner, repo, branch string, headers *Headers) (*Commit, error)
}

type InnerTree

type InnerTree struct {
	ID   string     `json:"id"`
	Name string     `json:"name"`
	Type ObjectType `json:"type"`
	Path string     `json:"path"`
	Mode string     `json:"mode"`
}

type ObjectType

type ObjectType string
const (
	ObjectTypeDir  ObjectType = "tree"
	ObjectTypeFile ObjectType = "blob"
)

type Tree

type Tree []InnerTree

func (*Tree) ListAll

func (t *Tree) ListAll() []string

ListAll list all file/dir in repo tree

func (*Tree) ListAllDirs

func (t *Tree) ListAllDirs() []string

ListAllDirs list all directories in repo tree

func (*Tree) ListAllFiles

func (t *Tree) ListAllFiles() []string

ListAllFiles list all files in repo tree

Jump to

Keyboard shortcuts

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