/
types.go
43 lines (37 loc) · 978 Bytes
/
types.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package scm_provider
import (
"context"
"regexp"
)
// An abstract repository from an API provider.
type Repository struct {
Organization string
Repository string
URL string
Branch string
SHA string
Labels []string
RepositoryId interface{}
}
type SCMProviderService interface {
ListRepos(context.Context, string) ([]*Repository, error)
RepoHasPath(context.Context, *Repository, string) (bool, error)
GetBranches(context.Context, *Repository) ([]*Repository, error)
}
// A compiled version of SCMProviderGeneratorFilter for performance.
type Filter struct {
RepositoryMatch *regexp.Regexp
PathsExist []string
PathsDoNotExist []string
LabelMatch *regexp.Regexp
BranchMatch *regexp.Regexp
FilterType FilterType
}
// A convenience type for indicating where to apply a filter
type FilterType int64
// The enum of filter types
const (
FilterTypeUndefined FilterType = iota
FilterTypeBranch
FilterTypeRepo
)