-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathcheck_package_version.go
34 lines (31 loc) · 1.84 KB
/
check_package_version.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
package opslevel
type PackageVersionCheckFragment struct {
MissingPackageResult *CheckResultStatusEnum `graphql:"missingPackageResult"` // The check result if the package isn't being used by a service.
PackageConstraint PackageConstraintEnum `graphql:"packageConstraint"` // The package constraint the service is to be checked for.
PackageManager PackageManagerEnum `graphql:"packageManager"` // The package manager (ecosystem) this package relates to.
PackageName string `graphql:"packageName"` // The name of the package to be checked.
PackageNameIsRegex bool `graphql:"packageNameIsRegex"` // Whether or not the value in the package name field is a regular expression.
VersionConstraintPredicate *Predicate `graphql:"versionConstraintPredicate"` // The predicate that describes the version constraint the package must satisfy.
}
// CreateCheckPackageVersion Creates a package version check.
func (client *Client) CreateCheckPackageVersion(input CheckPackageVersionCreateInput) (*Check, error) {
var m struct {
Payload CheckResponsePayload `graphql:"checkPackageVersionCreate(input: $input)"`
}
v := PayloadVariables{
"input": input,
}
err := client.Mutate(&m, v, WithName("CheckPackageVersionCreate"))
return &m.Payload.Check, HandleErrors(err, m.Payload.Errors)
}
// UpdateCheckPackageVersion Updates a package version check.
func (client *Client) UpdateCheckPackageVersion(input CheckPackageVersionUpdateInput) (*Check, error) {
var m struct {
Payload CheckResponsePayload `graphql:"checkPackageVersionUpdate(input: $input)"`
}
v := PayloadVariables{
"input": input,
}
err := client.Mutate(&m, v, WithName("CheckPackageVersionUpdate"))
return &m.Payload.Check, HandleErrors(err, m.Payload.Errors)
}