Skip to content

Commit 7bf1215

Browse files
authored
Add ability to “interface” with the nodes of a connection type (#531)
1 parent 66a3622 commit 7bf1215

File tree

9 files changed

+44
-0
lines changed

9 files changed

+44
-0
lines changed

actions.go

+8
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,20 @@ type CustomActionsExternalActionsConnection struct {
4949
TotalCount int
5050
}
5151

52+
func (s *CustomActionsExternalActionsConnection) GetNodes() any {
53+
return s.Nodes
54+
}
55+
5256
type CustomActionsTriggerDefinitionsConnection struct {
5357
Nodes []CustomActionsTriggerDefinition
5458
PageInfo PageInfo
5559
TotalCount int `graphql:"-"`
5660
}
5761

62+
func (s *CustomActionsTriggerDefinitionsConnection) GetNodes() any {
63+
return s.Nodes
64+
}
65+
5866
func (client *Client) CreateWebhookAction(input CustomActionsWebhookActionCreateInput) (*CustomActionsExternalAction, error) {
5967
var m struct {
6068
Payload struct { // TODO: fix this

common.go

+4
Original file line numberDiff line numberDiff line change
@@ -89,3 +89,7 @@ func extractAliases(existingAliases, aliasesWanted []string) ([]string, []string
8989
}
9090
return aliasesToCreate, aliasesToDelete
9191
}
92+
93+
type Connection interface {
94+
GetNodes() any
95+
}

domain.go

+4
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ type DomainConnection struct {
1212
TotalCount int `json:"totalCount" graphql:"-"`
1313
}
1414

15+
func (s *DomainConnection) GetNodes() any {
16+
return s.Nodes
17+
}
18+
1519
// Returns unique identifiers created by OpsLevel, values in Aliases but not ManagedAliases
1620
func (d *Domain) UniqueIdentifiers() []string {
1721
uniqueIdentifiers := []string{}

filters.go

+4
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,10 @@ type FilterConnection struct {
185185
TotalCount int
186186
}
187187

188+
func (s *FilterConnection) GetNodes() any {
189+
return s.Nodes
190+
}
191+
188192
func (filter *Filter) Alias() string {
189193
return slug.Make(filter.Name)
190194
}

infra.go

+4
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ type InfrastructureResourceConnection struct {
4242
TotalCount int `graphql:"-"`
4343
}
4444

45+
func (s *InfrastructureResourceConnection) GetNodes() any {
46+
return s.Nodes
47+
}
48+
4549
type InfraProviderInput struct {
4650
Account string `json:"account" yaml:"account" default:"Dev - 123456789"`
4751
Name string `json:"name" yaml:"name" default:"Google"`

service.go

+4
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ type ServiceConnection struct {
4949
TotalCount int
5050
}
5151

52+
func (s *ServiceConnection) GetNodes() any {
53+
return s.Nodes
54+
}
55+
5256
type ServiceDocumentsConnection struct {
5357
Nodes []ServiceDocument
5458
PageInfo PageInfo

system.go

+4
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ type SystemConnection struct {
1212
TotalCount int `json:"totalCount" graphql:"-"`
1313
}
1414

15+
func (s *SystemConnection) GetNodes() any {
16+
return s.Nodes
17+
}
18+
1519
func (systemId *SystemId) GetTags(client *Client, variables *PayloadVariables) (*TagConnection, error) {
1620
var q struct {
1721
Account struct {

team.go

+8
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,20 @@ type TeamIdConnection struct {
3535
TotalCount int
3636
}
3737

38+
func (s *TeamIdConnection) GetNodes() any {
39+
return s.Nodes
40+
}
41+
3842
type TeamConnection struct {
3943
Nodes []Team
4044
PageInfo PageInfo
4145
TotalCount int
4246
}
4347

48+
func (s *TeamConnection) GetNodes() any {
49+
return s.Nodes
50+
}
51+
4452
type TeamMembershipConnection struct {
4553
Nodes []TeamMembership
4654
PageInfo PageInfo

user.go

+4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ type UserConnection struct {
1111
TotalCount int
1212
}
1313

14+
func (s *UserConnection) GetNodes() any {
15+
return s.Nodes
16+
}
17+
1418
func (user *User) ResourceId() ID {
1519
return user.Id
1620
}

0 commit comments

Comments
 (0)