clients

package
v2.2.8 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 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 added in v2.2.3

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

func (*AllowDeletions) Descriptor deprecated added in v2.2.3

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

Deprecated: Use AllowDeletions.ProtoReflect.Descriptor instead.

func (*AllowDeletions) GetEnabled added in v2.2.3

func (x *AllowDeletions) GetEnabled() bool

func (*AllowDeletions) ProtoMessage added in v2.2.3

func (*AllowDeletions) ProtoMessage()

func (*AllowDeletions) ProtoReflect added in v2.2.3

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

func (*AllowDeletions) Reset added in v2.2.3

func (x *AllowDeletions) Reset()

func (*AllowDeletions) String added in v2.2.3

func (x *AllowDeletions) String() string

type AllowForcePushes added in v2.2.3

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

func (*AllowForcePushes) Descriptor deprecated added in v2.2.3

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

Deprecated: Use AllowForcePushes.ProtoReflect.Descriptor instead.

func (*AllowForcePushes) GetEnabled added in v2.2.3

func (x *AllowForcePushes) GetEnabled() bool

func (*AllowForcePushes) ProtoMessage added in v2.2.3

func (*AllowForcePushes) ProtoMessage()

func (*AllowForcePushes) ProtoReflect added in v2.2.3

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

func (*AllowForcePushes) Reset added in v2.2.3

func (x *AllowForcePushes) Reset()

func (*AllowForcePushes) String added in v2.2.3

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 added in v2.2.3

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

Deprecated: Use BranchProtectionRule.ProtoReflect.Descriptor instead.

func (*BranchProtectionRule) GetAllowDeletions added in v2.2.3

func (x *BranchProtectionRule) GetAllowDeletions() *AllowDeletions

func (*BranchProtectionRule) GetAllowForcePushes added in v2.2.3

func (x *BranchProtectionRule) GetAllowForcePushes() *AllowForcePushes

func (*BranchProtectionRule) GetEnforceAdmins added in v2.2.3

func (x *BranchProtectionRule) GetEnforceAdmins() *EnforceAdmins

func (*BranchProtectionRule) GetRequireLinearHistory added in v2.2.3

func (x *BranchProtectionRule) GetRequireLinearHistory() *RequireLinearHistory

func (*BranchProtectionRule) GetRequiredPullRequestReviews added in v2.2.3

func (x *BranchProtectionRule) GetRequiredPullRequestReviews() *PullRequestReviewRule

func (*BranchProtectionRule) GetRequiredStatusChecks added in v2.2.3

func (x *BranchProtectionRule) GetRequiredStatusChecks() *StatusChecksRule

func (*BranchProtectionRule) ProtoMessage added in v2.2.3

func (*BranchProtectionRule) ProtoMessage()

func (*BranchProtectionRule) ProtoReflect added in v2.2.3

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

func (*BranchProtectionRule) Reset added in v2.2.3

func (x *BranchProtectionRule) Reset()

func (*BranchProtectionRule) String added in v2.2.3

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 added in v2.2.3

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

Deprecated: Use BranchRef.ProtoReflect.Descriptor instead.

func (*BranchRef) GetBranchProtectionRule added in v2.2.3

func (x *BranchRef) GetBranchProtectionRule() *BranchProtectionRule

func (*BranchRef) GetName added in v2.2.3

func (x *BranchRef) GetName() string

func (*BranchRef) GetProtected added in v2.2.3

func (x *BranchRef) GetProtected() bool

func (*BranchRef) ProtoMessage added in v2.2.3

func (*BranchRef) ProtoMessage()

func (*BranchRef) ProtoReflect added in v2.2.3

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

func (*BranchRef) Reset added in v2.2.3

func (x *BranchRef) Reset()

func (*BranchRef) String added in v2.2.3

func (x *BranchRef) String() string

type CheckRun added in v2.2.3

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

CheckRun is a single instance of a VCS CheckRun.

type CheckRunApp added in v2.2.3

type CheckRunApp struct {
	Slug string
}

CheckRunApp is the app running the Check.

type Commit added in v2.1.3

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

Commit represents a Git commit.

type Contributor added in v2.2.3

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

Contributor represents a contributor to a repo.

type EnforceAdmins added in v2.2.3

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

func (*EnforceAdmins) Descriptor deprecated added in v2.2.3

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

Deprecated: Use EnforceAdmins.ProtoReflect.Descriptor instead.

func (*EnforceAdmins) GetEnabled added in v2.2.3

func (x *EnforceAdmins) GetEnabled() bool

func (*EnforceAdmins) ProtoMessage added in v2.2.3

func (*EnforceAdmins) ProtoMessage()

func (*EnforceAdmins) ProtoReflect added in v2.2.3

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

func (*EnforceAdmins) Reset added in v2.2.3

func (x *EnforceAdmins) Reset()

func (*EnforceAdmins) String added in v2.2.3

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 added in v2.2.3

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 added in v2.2.3

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

Deprecated: Use PullRequestReviewRule.ProtoReflect.Descriptor instead.

func (*PullRequestReviewRule) GetDismissStaleReviews added in v2.2.3

func (x *PullRequestReviewRule) GetDismissStaleReviews() bool

func (*PullRequestReviewRule) GetRequireCodeOwnerReviews added in v2.2.3

func (x *PullRequestReviewRule) GetRequireCodeOwnerReviews() bool

func (*PullRequestReviewRule) GetRequiredApprovingReviewCount added in v2.2.3

func (x *PullRequestReviewRule) GetRequiredApprovingReviewCount() int32

func (*PullRequestReviewRule) ProtoMessage added in v2.2.3

func (*PullRequestReviewRule) ProtoMessage()

func (*PullRequestReviewRule) ProtoReflect added in v2.2.3

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

func (*PullRequestReviewRule) Reset added in v2.2.3

func (x *PullRequestReviewRule) Reset()

func (*PullRequestReviewRule) String added in v2.2.3

func (x *PullRequestReviewRule) String() string

type Release added in v2.2.3

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

Release represents a release version of a package/repo.

type ReleaseAsset added in v2.2.3

type ReleaseAsset struct {
	Name string
	URL  string
}

ReleaseAsset is part of the Release bundle.

type Repo added in v2.2.8

type Repo interface {
	URL() 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
	URL() 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 added in v2.2.3

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

func (*RequireLinearHistory) Descriptor deprecated added in v2.2.3

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

Deprecated: Use RequireLinearHistory.ProtoReflect.Descriptor instead.

func (*RequireLinearHistory) GetEnabled added in v2.2.3

func (x *RequireLinearHistory) GetEnabled() bool

func (*RequireLinearHistory) ProtoMessage added in v2.2.3

func (*RequireLinearHistory) ProtoMessage()

func (*RequireLinearHistory) ProtoReflect added in v2.2.3

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

func (*RequireLinearHistory) Reset added in v2.2.3

func (x *RequireLinearHistory) Reset()

func (*RequireLinearHistory) String added in v2.2.3

func (x *RequireLinearHistory) String() string

type Review

type Review struct {
	State string
}

Review represents a PR review.

type SearchRequest added in v2.2.3

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 added in v2.2.3

type SearchResponse struct {
	Results []SearchResult
	Hits    int
}

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

type SearchResult added in v2.2.3

type SearchResult struct {
	Path string
}

SearchResult represents a matching result from the search query.

type Status added in v2.2.3

type Status struct {
	State   string
	Context string
	URL     string
}

Status for a Git object/ref.

type StatusChecksRule added in v2.2.3

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 added in v2.2.3

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

Deprecated: Use StatusChecksRule.ProtoReflect.Descriptor instead.

func (*StatusChecksRule) GetContexts added in v2.2.3

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

func (*StatusChecksRule) GetStrict added in v2.2.3

func (x *StatusChecksRule) GetStrict() bool

func (*StatusChecksRule) ProtoMessage added in v2.2.3

func (*StatusChecksRule) ProtoMessage()

func (*StatusChecksRule) ProtoReflect added in v2.2.3

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

func (*StatusChecksRule) Reset added in v2.2.3

func (x *StatusChecksRule) Reset()

func (*StatusChecksRule) String added in v2.2.3

func (x *StatusChecksRule) String() string

type User added in v2.1.3

type User struct {
	Login string
}

User represents a Git user.

type WorkflowRun added in v2.2.3

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.
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