2021-06-17 23:21:32 +03:00
|
|
|
// Copyright 2021 Security Scorecard Authors
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
|
|
|
//
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
//
|
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
2021-08-01 01:31:34 +03:00
|
|
|
// Package clients defines the interface for RepoClient and related structs.
|
2021-06-17 23:21:32 +03:00
|
|
|
package clients
|
|
|
|
|
2021-11-02 04:43:22 +03:00
|
|
|
import "errors"
|
|
|
|
|
|
|
|
// ErrUnsupportedFeature indicates an API that is not supported by the client.
|
|
|
|
var ErrUnsupportedFeature = errors.New("unsupported feature")
|
|
|
|
|
2022-02-15 01:24:35 +03:00
|
|
|
// HeadSHA is default commitSHA value used to denote git HEAD.
|
|
|
|
const HeadSHA = "HEAD"
|
|
|
|
|
2021-08-01 01:31:34 +03:00
|
|
|
// RepoClient interface is used by Scorecard checks to access a repo.
|
2021-06-17 23:21:32 +03:00
|
|
|
type RepoClient interface {
|
2022-02-08 06:03:36 +03:00
|
|
|
InitRepo(repo Repo, commitSHA string) error
|
2021-10-21 23:08:56 +03:00
|
|
|
URI() string
|
2021-07-30 00:18:58 +03:00
|
|
|
IsArchived() (bool, error)
|
2021-07-26 03:47:36 +03:00
|
|
|
ListFiles(predicate func(string) (bool, error)) ([]string, error)
|
2021-07-01 09:49:49 +03:00
|
|
|
GetFileContent(filename string) ([]byte, error)
|
2021-08-31 02:14:42 +03:00
|
|
|
ListBranches() ([]*BranchRef, error)
|
|
|
|
GetDefaultBranch() (*BranchRef, error)
|
2021-07-30 00:18:58 +03:00
|
|
|
ListCommits() ([]Commit, error)
|
2021-11-13 01:16:22 +03:00
|
|
|
ListIssues() ([]Issue, error)
|
2021-08-12 23:46:06 +03:00
|
|
|
ListReleases() ([]Release, error)
|
2021-08-13 21:13:43 +03:00
|
|
|
ListContributors() ([]Contributor, error)
|
2021-09-01 04:05:34 +03:00
|
|
|
ListSuccessfulWorkflowRuns(filename string) ([]WorkflowRun, error)
|
2021-09-01 20:43:53 +03:00
|
|
|
ListCheckRunsForRef(ref string) ([]CheckRun, error)
|
2021-09-01 21:34:58 +03:00
|
|
|
ListStatuses(ref string) ([]Status, error)
|
2021-08-16 20:34:10 +03:00
|
|
|
Search(request SearchRequest) (SearchResponse, error)
|
2021-07-01 09:49:49 +03:00
|
|
|
Close() error
|
2021-06-17 23:21:32 +03:00
|
|
|
}
|