gitnessclient

package
v0.32.0 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetCloneUrl

func GetCloneUrl(protocol, host, owner, repo string) string

Types

type AddedBy

type AddedBy struct {
	ID          int64  `json:"id"`
	UID         string `json:"uid"`
	DisplayName string `json:"display_name"`
	Email       string `json:"email"`
	Type        string `json:"type"`
	Created     int64  `json:"created"`
	Updated     int64  `json:"updated"`
}

type Commit

type Commit struct {
	Sha        string   `json:"sha"`
	ParentShas []string `json:"parent_shas"`
	Title      string   `json:"title"`
	Message    string   `json:"message"`
	Author     struct {
		Identity struct {
			Name  string `json:"name"`
			Email string `json:"email"`
		} `json:"identity"`
		When time.Time `json:"when"`
	} `json:"author"`
	Committer struct {
		Identity struct {
			Name  string `json:"name"`
			Email string `json:"email"`
		} `json:"identity"`
		When time.Time `json:"when"`
	} `json:"committer"`
	Stats struct {
		Total struct {
			Insertions int `json:"insertions"`
			Deletions  int `json:"deletions"`
			Changes    int `json:"changes"`
		} `json:"total"`
	} `json:"stats"`
}

type CommitsResponse

type CommitsResponse struct {
	Commits []Commit `json:"commits"`
}

type GitnessClient

type GitnessClient struct {
	BaseURL *url.URL
	// contains filtered or unexported fields
}

func NewGitnessClient

func NewGitnessClient(token string, baseUrl *url.URL) *GitnessClient

func (*GitnessClient) GetCommits added in v0.26.0

func (g *GitnessClient) GetCommits(owner string, repositoryName string, branch *string) (*[]Commit, error)

func (*GitnessClient) GetDefaultBranch added in v0.26.0

func (g *GitnessClient) GetDefaultBranch(url string) (*string, error)

func (*GitnessClient) GetLastCommitSha

func (g *GitnessClient) GetLastCommitSha(repoURL string, branch *string) (string, error)

func (*GitnessClient) GetPr

func (g *GitnessClient) GetPr(repoURL string, prNumber uint32) (*PullRequest, error)

func (*GitnessClient) GetRepoBranches

func (g *GitnessClient) GetRepoBranches(repositoryId string, namespaceId string) ([]*RepoBranch, error)

func (*GitnessClient) GetRepoPRs

func (g *GitnessClient) GetRepoPRs(repositoryId string, namespaceId string) ([]*PR, error)

func (*GitnessClient) GetRepoRef

func (g *GitnessClient) GetRepoRef(url string) (*string, error)

func (*GitnessClient) GetRepositories

func (g *GitnessClient) GetRepositories(namespace string) ([]Repository, error)

func (*GitnessClient) GetRepository added in v0.26.0

func (g *GitnessClient) GetRepository(url string) (*Repository, error)

func (*GitnessClient) GetSpaceAdmin

func (g *GitnessClient) GetSpaceAdmin(spaceName string) (*SpaceMemberResponse, error)

func (*GitnessClient) GetSpaces

func (g *GitnessClient) GetSpaces() ([]MembershipResponse, error)

func (*GitnessClient) GetUser

func (g *GitnessClient) GetUser() (*UserResponse, error)

type MembershipResponse

type MembershipResponse struct {
	Created int64  `json:"created"`
	Updated int64  `json:"updated"`
	Role    string `json:"role"`
	Space   Space  `json:"space"`
	AddedBy User   `json:"added_by"`
}

type PR

type PR struct {
	Title        string `json:"title"`
	SourceBranch string `json:"source_branch"`
	SourceSha    string `json:"source_sha"`
	SourceRepoId int    `json:"source_repo_id"`
	Author       struct {
		DisplayName string `json:"display_name"`
		Email       string `json:"email"`
	} `json:"author"`
}

type Principal

type Principal struct {
	ID          int64  `json:"id"`
	UID         string `json:"uid"`
	DisplayName string `json:"display_name"`
	Email       string `json:"email"`
	Type        string `json:"type"`
	Created     int64  `json:"created"`
	Updated     int64  `json:"updated"`
}

type PullRequest

type PullRequest struct {
	GitUrl           string
	Number           int     `json:"number"`
	Created          int64   `json:"created"`
	Edited           int64   `json:"edited"`
	State            string  `json:"state"`
	IsDraft          bool    `json:"is_draft"`
	Title            string  `json:"title"`
	Description      string  `json:"description"`
	SourceRepoID     int     `json:"source_repo_id"`
	SourceBranch     string  `json:"source_branch"`
	SourceSha        string  `json:"source_sha"`
	TargetRepoID     int     `json:"target_repo_id"`
	TargetBranch     string  `json:"target_branch"`
	Merged           *bool   `json:"merged"`
	MergeMethod      *string `json:"merge_method"`
	MergeCheckStatus string  `json:"merge_check_status"`
	MergeTargetSha   string  `json:"merge_target_sha"`
	MergeBaseSha     string  `json:"merge_base_sha"`
	Author           struct {
		ID          int    `json:"id"`
		UID         string `json:"uid"`
		DisplayName string `json:"display_name"`
		Email       string `json:"email"`
		Type        string `json:"type"`
		Created     int64  `json:"created"`
		Updated     int64  `json:"updated"`
	} `json:"author"`
	Merger *struct {
		ID          int    `json:"id"`
		UID         string `json:"uid"`
		DisplayName string `json:"display_name"`
		Email       string `json:"email"`
		Type        string `json:"type"`
		Created     int64  `json:"created"`
		Updated     int64  `json:"updated"`
	} `json:"merger"`
	Stats struct {
		Commits      int `json:"commits"`
		FilesChanged int `json:"files_changed"`
	} `json:"stats"`
}

type RepoBranch

type RepoBranch struct {
	Name string `json:"name"`
	Sha  string `json:"sha"`
}

type Repository

type Repository struct {
	Id             int    `json:"id"`
	ParentId       int    `json:"parent_id"`
	Identifier     string `json:"identifier"`
	Path           string `json:"path"`
	Description    string `json:"description"`
	IsPublic       bool   `json:"is_public"`
	CreatedBy      int    `json:"created_by"`
	Created        int64  `json:"created"`
	Updated        int64  `json:"updated"`
	Size           int    `json:"size"`
	SizeUpdated    int    `json:"size_updated"`
	DefaultBranch  string `json:"default_branch"`
	ForkId         int    `json:"fork_id"`
	NumForks       int    `json:"num_forks"`
	NumPulls       int    `json:"num_pulls"`
	NumClosedPulls int    `json:"num_closed_pulls"`
	NumOpenPulls   int    `json:"num_open_pulls"`
	NumMergedPulls int    `json:"num_merged_pulls"`
	Importing      bool   `json:"importing"`
	GitUrl         string `json:"git_url"`
	Uid            string `json:"uid"`
}

type Space

type Space struct {
	ID          int    `json:"id"`
	ParentID    int    `json:"parent_id"`
	Path        string `json:"path"`
	Identifier  string `json:"identifier"`
	Description string `json:"description"`
	IsPublic    bool   `json:"is_public"`
	CreatedBy   int    `json:"created_by"`
	Created     int64  `json:"created"`
	Updated     int64  `json:"updated"`
	UID         string `json:"uid"`
}

type SpaceMemberResponse

type SpaceMemberResponse struct {
	Created   int64     `json:"created"`
	Updated   int64     `json:"updated"`
	Role      string    `json:"role"`
	Principal Principal `json:"principal"`
	AddedBy   AddedBy   `json:"added_by"`
}

type User

type User struct {
	ID          int    `json:"id"`
	UID         string `json:"uid"`
	DisplayName string `json:"display_name"`
	Email       string `json:"email"`
	Type        string `json:"type"`
	Created     int64  `json:"created"`
	Updated     int64  `json:"updated"`
}

type UserResponse

type UserResponse struct {
	UID         string `json:"uid"`
	Email       string `json:"email"`
	DisplayName string `json:"display_name"`
	Admin       bool   `json:"admin"`
	Blocked     bool   `json:"blocked"`
	Created     int64  `json:"created"`
	Updated     int64  `json:"updated"`
}

Jump to

Keyboard shortcuts

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