-
Notifications
You must be signed in to change notification settings - Fork 13
/
check_repo_file.go
30 lines (27 loc) · 1.38 KB
/
check_repo_file.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
package opslevel
type RepositoryFileCheckFragment struct {
DirectorySearch bool `graphql:"directorySearch"` // Whether the check looks for the existence of a directory instead of a file.
FileContentsPredicate *Predicate `graphql:"fileContentsPredicate"` // Condition to match the file content.
Filepaths []string `graphql:"filePaths"` // Restrict the search to certain file paths.
UseAbsoluteRoot bool `graphql:"useAbsoluteRoot"` // Whether the checks looks at the absolute root of a repo or the relative root (the directory specified when attached a repo to a service).
}
func (client *Client) CreateCheckRepositoryFile(input CheckRepositoryFileCreateInput) (*Check, error) {
var m struct {
Payload CheckResponsePayload `graphql:"checkRepositoryFileCreate(input: $input)"`
}
v := PayloadVariables{
"input": input,
}
err := client.Mutate(&m, v, WithName("CheckRepositoryFileCreate"))
return &m.Payload.Check, HandleErrors(err, m.Payload.Errors)
}
func (client *Client) UpdateCheckRepositoryFile(input CheckRepositoryFileUpdateInput) (*Check, error) {
var m struct {
Payload CheckResponsePayload `graphql:"checkRepositoryFileUpdate(input: $input)"`
}
v := PayloadVariables{
"input": input,
}
err := client.Mutate(&m, v, WithName("CheckRepositoryFileUpdate"))
return &m.Payload.Check, HandleErrors(err, m.Payload.Errors)
}