clients

package
v3.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2021 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package clients defines the interface for RepoClient and related structs.

Index

Constants

This section is empty.

Variables

View Source
var File_clients_branch_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type AllowDeletions

type AllowDeletions struct {
	Enabled bool `protobuf:"varint,1,opt,name=enabled,proto3" json:"enabled,omitempty"`
	// contains filtered or unexported fields
}

func (*AllowDeletions) Descriptor deprecated

func (*AllowDeletions) Descriptor() ([]byte, []int)

Deprecated: Use AllowDeletions.ProtoReflect.Descriptor instead.

func (*AllowDeletions) GetEnabled

func (x *AllowDeletions) GetEnabled() bool

func (*AllowDeletions) ProtoMessage

func (*AllowDeletions) ProtoMessage()

func (*AllowDeletions) ProtoReflect

func (x *AllowDeletions) ProtoReflect() protoreflect.Message

func (*AllowDeletions) Reset

func (x *AllowDeletions) Reset()

func (*AllowDeletions) String

func (x *AllowDeletions) String() string

type AllowForcePushes

type AllowForcePushes struct {
	Enabled bool `protobuf:"varint,1,opt,name=enabled,proto3" json:"enabled,omitempty"`
	// contains filtered or unexported fields
}

func (*AllowForcePushes) Descriptor deprecated

func (*AllowForcePushes) Descriptor() ([]byte, []int)

Deprecated: Use AllowForcePushes.ProtoReflect.Descriptor instead.

func (*AllowForcePushes) GetEnabled

func (x *AllowForcePushes) GetEnabled() bool

func (*AllowForcePushes) ProtoMessage

func (*AllowForcePushes) ProtoMessage()

func (*AllowForcePushes) ProtoReflect

func (x *AllowForcePushes) ProtoReflect() protoreflect.Message

func (*AllowForcePushes) Reset

func (x *AllowForcePushes) Reset()

func (*AllowForcePushes) String

func (x *AllowForcePushes) String() string

type BranchProtectionRule

type BranchProtectionRule struct {
	AllowDeletions             *AllowDeletions        `protobuf:"bytes,1,opt,name=allow_deletions,json=allowDeletions,proto3" json:"allow_deletions,omitempty"`
	AllowForcePushes           *AllowForcePushes      `protobuf:"bytes,2,opt,name=allow_force_pushes,json=allowForcePushes,proto3" json:"allow_force_pushes,omitempty"`
	RequireLinearHistory       *RequireLinearHistory  `protobuf:"bytes,3,opt,name=require_linear_history,json=requireLinearHistory,proto3" json:"require_linear_history,omitempty"`
	EnforceAdmins              *EnforceAdmins         `protobuf:"bytes,4,opt,name=enforce_admins,json=enforceAdmins,proto3" json:"enforce_admins,omitempty"`
	RequiredStatusChecks       *StatusChecksRule      `protobuf:"bytes,5,opt,name=required_status_checks,json=requiredStatusChecks,proto3" json:"required_status_checks,omitempty"`
	RequiredPullRequestReviews *PullRequestReviewRule `` /* 143-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*BranchProtectionRule) Descriptor deprecated

func (*BranchProtectionRule) Descriptor() ([]byte, []int)

Deprecated: Use BranchProtectionRule.ProtoReflect.Descriptor instead.

func (*BranchProtectionRule) GetAllowDeletions

func (x *BranchProtectionRule) GetAllowDeletions() *AllowDeletions

func (*BranchProtectionRule) GetAllowForcePushes

func (x *BranchProtectionRule) GetAllowForcePushes() *AllowForcePushes

func (*BranchProtectionRule) GetEnforceAdmins

func (x *BranchProtectionRule) GetEnforceAdmins() *EnforceAdmins

func (*BranchProtectionRule) GetRequireLinearHistory

func (x *BranchProtectionRule) GetRequireLinearHistory() *RequireLinearHistory

func (*BranchProtectionRule) GetRequiredPullRequestReviews

func (x *BranchProtectionRule) GetRequiredPullRequestReviews() *PullRequestReviewRule

func (*BranchProtectionRule) GetRequiredStatusChecks

func (x *BranchProtectionRule) GetRequiredStatusChecks() *StatusChecksRule

func (*BranchProtectionRule) ProtoMessage

func (*BranchProtectionRule) ProtoMessage()

func (*BranchProtectionRule) ProtoReflect

func (x *BranchProtectionRule) ProtoReflect() protoreflect.Message

func (*BranchProtectionRule) Reset

func (x *BranchProtectionRule) Reset()

func (*BranchProtectionRule) String

func (x *BranchProtectionRule) String() string

type BranchRef

type BranchRef struct {
	Name                 string                `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Protected            bool                  `protobuf:"varint,2,opt,name=protected,proto3" json:"protected,omitempty"`
	BranchProtectionRule *BranchProtectionRule `protobuf:"bytes,3,opt,name=branch_protection_rule,json=branchProtectionRule,proto3" json:"branch_protection_rule,omitempty"`
	// contains filtered or unexported fields
}

func (*BranchRef) Descriptor deprecated

func (*BranchRef) Descriptor() ([]byte, []int)

Deprecated: Use BranchRef.ProtoReflect.Descriptor instead.

func (*BranchRef) GetBranchProtectionRule

func (x *BranchRef) GetBranchProtectionRule() *BranchProtectionRule

func (*BranchRef) GetName

func (x *BranchRef) GetName() string

func (*BranchRef) GetProtected

func (x *BranchRef) GetProtected() bool

func (*BranchRef) ProtoMessage

func (*BranchRef) ProtoMessage()

func (*BranchRef) ProtoReflect

func (x *BranchRef) ProtoReflect() protoreflect.Message

func (*BranchRef) Reset

func (x *BranchRef) Reset()

func (*BranchRef) String

func (x *BranchRef) String() string

type CheckRun

type CheckRun struct {
	Status     string
	Conclusion string
	URL        string
	App        CheckRunApp
}

CheckRun is a single instance of a VCS CheckRun.

type CheckRunApp

type CheckRunApp struct {
	Slug string
}

CheckRunApp is the app running the Check.

type Commit

type Commit struct {
	CommittedDate time.Time
	Message       string
	SHA           string
	Committer     User
}

Commit represents a Git commit.

type Contributor

type Contributor struct {
	Company          string
	User             User
	Organizations    []User
	NumContributions int
}

Contributor represents a contributor to a repo.

type EnforceAdmins

type EnforceAdmins struct {
	Enabled bool `protobuf:"varint,1,opt,name=enabled,proto3" json:"enabled,omitempty"`
	// contains filtered or unexported fields
}

func (*EnforceAdmins) Descriptor deprecated

func (*EnforceAdmins) Descriptor() ([]byte, []int)

Deprecated: Use EnforceAdmins.ProtoReflect.Descriptor instead.

func (*EnforceAdmins) GetEnabled

func (x *EnforceAdmins) GetEnabled() bool

func (*EnforceAdmins) ProtoMessage

func (*EnforceAdmins) ProtoMessage()

func (*EnforceAdmins) ProtoReflect

func (x *EnforceAdmins) ProtoReflect() protoreflect.Message

func (*EnforceAdmins) Reset

func (x *EnforceAdmins) Reset()

func (*EnforceAdmins) String

func (x *EnforceAdmins) String() string

type Label

type Label struct {
	Name string
}

Label represents a PR label.

type PullRequest

type PullRequest struct {
	MergedAt    time.Time
	MergeCommit Commit
	Number      int
	HeadSHA     string
	Labels      []Label
	Reviews     []Review
	Author      User
}

PullRequest struct represents a PR as returned by RepoClient. nolint: govet

type PullRequestReviewRule

type PullRequestReviewRule struct {
	RequiredApprovingReviewCount int32 `` /* 150-byte string literal not displayed */
	DismissStaleReviews          bool  `protobuf:"varint,2,opt,name=dismiss_stale_reviews,json=dismissStaleReviews,proto3" json:"dismiss_stale_reviews,omitempty"`
	RequireCodeOwnerReviews      bool  `` /* 135-byte string literal not displayed */
	// contains filtered or unexported fields
}

func (*PullRequestReviewRule) Descriptor deprecated

func (*PullRequestReviewRule) Descriptor() ([]byte, []int)

Deprecated: Use PullRequestReviewRule.ProtoReflect.Descriptor instead.

func (*PullRequestReviewRule) GetDismissStaleReviews

func (x *PullRequestReviewRule) GetDismissStaleReviews() bool

func (*PullRequestReviewRule) GetRequireCodeOwnerReviews

func (x *PullRequestReviewRule) GetRequireCodeOwnerReviews() bool

func (*PullRequestReviewRule) GetRequiredApprovingReviewCount

func (x *PullRequestReviewRule) GetRequiredApprovingReviewCount() int32

func (*PullRequestReviewRule) ProtoMessage

func (*PullRequestReviewRule) ProtoMessage()

func (*PullRequestReviewRule) ProtoReflect

func (x *PullRequestReviewRule) ProtoReflect() protoreflect.Message

func (*PullRequestReviewRule) Reset

func (x *PullRequestReviewRule) Reset()

func (*PullRequestReviewRule) String

func (x *PullRequestReviewRule) String() string

type Release

type Release struct {
	TagName         string
	URL             string
	TargetCommitish string
	Assets          []ReleaseAsset
}

Release represents a release version of a package/repo.

type ReleaseAsset

type ReleaseAsset struct {
	Name string
	URL  string
}

ReleaseAsset is part of the Release bundle.

type Repo

type Repo interface {
	URI() string
	String() string
	Org() Repo
	IsValid() error
	Metadata() []string
	AppendMetadata(metadata ...string)
	// TODO: Find a better alterntive.
	IsScorecardRepo() bool
}

Repo interface uniquely identifies a repo.

type RepoClient

type RepoClient interface {
	InitRepo(repo Repo) error
	URI() string
	IsArchived() (bool, error)
	ListFiles(predicate func(string) (bool, error)) ([]string, error)
	GetFileContent(filename string) ([]byte, error)
	ListMergedPRs() ([]PullRequest, error)
	ListBranches() ([]*BranchRef, error)
	GetDefaultBranch() (*BranchRef, error)
	ListCommits() ([]Commit, error)
	ListReleases() ([]Release, error)
	ListContributors() ([]Contributor, error)
	ListSuccessfulWorkflowRuns(filename string) ([]WorkflowRun, error)
	ListCheckRunsForRef(ref string) ([]CheckRun, error)
	ListStatuses(ref string) ([]Status, error)
	Search(request SearchRequest) (SearchResponse, error)
	Close() error
}

RepoClient interface is used by Scorecard checks to access a repo.

type RequireLinearHistory

type RequireLinearHistory struct {
	Enabled bool `protobuf:"varint,1,opt,name=enabled,proto3" json:"enabled,omitempty"`
	// contains filtered or unexported fields
}

func (*RequireLinearHistory) Descriptor deprecated

func (*RequireLinearHistory) Descriptor() ([]byte, []int)

Deprecated: Use RequireLinearHistory.ProtoReflect.Descriptor instead.

func (*RequireLinearHistory) GetEnabled

func (x *RequireLinearHistory) GetEnabled() bool

func (*RequireLinearHistory) ProtoMessage

func (*RequireLinearHistory) ProtoMessage()

func (*RequireLinearHistory) ProtoReflect

func (x *RequireLinearHistory) ProtoReflect() protoreflect.Message

func (*RequireLinearHistory) Reset

func (x *RequireLinearHistory) Reset()

func (*RequireLinearHistory) String

func (x *RequireLinearHistory) String() string

type Review

type Review struct {
	State string
}

Review represents a PR review.

type SearchRequest

type SearchRequest struct {
	Query    string
	Filename string
	Path     string
}

SearchRequest queries a repo for `Query`. If `Filename` is provided, only matching filenames are queried. If `Path` is provided, only files with matching paths are queried.

type SearchResponse

type SearchResponse struct {
	Results []SearchResult
	Hits    int
}

SearchResponse returns the results from a search request on a repo.

type SearchResult

type SearchResult struct {
	Path string
}

SearchResult represents a matching result from the search query.

type Status

type Status struct {
	State   string
	Context string
	URL     string
}

Status for a Git object/ref.

type StatusChecksRule

type StatusChecksRule struct {
	Strict   bool     `protobuf:"varint,1,opt,name=strict,proto3" json:"strict,omitempty"`
	Contexts []string `protobuf:"bytes,2,rep,name=contexts,proto3" json:"contexts,omitempty"`
	// contains filtered or unexported fields
}

func (*StatusChecksRule) Descriptor deprecated

func (*StatusChecksRule) Descriptor() ([]byte, []int)

Deprecated: Use StatusChecksRule.ProtoReflect.Descriptor instead.

func (*StatusChecksRule) GetContexts

func (x *StatusChecksRule) GetContexts() []string

func (*StatusChecksRule) GetStrict

func (x *StatusChecksRule) GetStrict() bool

func (*StatusChecksRule) ProtoMessage

func (*StatusChecksRule) ProtoMessage()

func (*StatusChecksRule) ProtoReflect

func (x *StatusChecksRule) ProtoReflect() protoreflect.Message

func (*StatusChecksRule) Reset

func (x *StatusChecksRule) Reset()

func (*StatusChecksRule) String

func (x *StatusChecksRule) String() string

type User

type User struct {
	Login string
}

User represents a Git user.

type WorkflowRun

type WorkflowRun struct {
	URL string
}

WorkflowRun represents VCS WorkflowRun.

Directories

Path Synopsis
Package githubrepo implements clients.RepoClient for GitHub.
Package githubrepo implements clients.RepoClient for GitHub.
roundtripper
Package roundtripper has implementations of http.RoundTripper useful to clients.RepoClient.
Package roundtripper has implementations of http.RoundTripper useful to clients.RepoClient.
roundtripper/tokens
Package tokens defines interface to access GitHub PATs.
Package tokens defines interface to access GitHub PATs.
roundtripper/tokens/server
Package main implements the GitHub token server.
Package main implements the GitHub token server.
Package localdir implements RepoClient on local source code.
Package localdir implements RepoClient on local source code.
Package mockrepo is a generated GoMock package.
Package mockrepo is a generated GoMock package.

Jump to

Keyboard shortcuts

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