diff --git a/document.go b/document.go index 2bb6de00..a744e848 100644 --- a/document.go +++ b/document.go @@ -17,6 +17,12 @@ type ServiceDocumentContent struct { Content string `graphql:"content" json:"content,omitempty"` } +type ServiceDocumentsContentConnection struct { + Nodes []ServiceDocumentContent + PageInfo PageInfo + TotalCount int `graphql:"-"` +} + func (client *Client) ServiceApiDocSettingsUpdate(service string, docPath string, docSource *ApiDocumentSourceEnum) (*Service, error) { var m struct { Payload struct { @@ -35,3 +41,21 @@ func (client *Client) ServiceApiDocSettingsUpdate(service string, docPath string err := client.Mutate(&m, v, WithName("ServiceApiDocSettingsUpdate")) return &m.Payload.Service, HandleErrors(err, m.Payload.Errors) } + +func (client *Client) ServiceDocumentSearch(service string, searchTerm string, docType *DocumentTypeEnum, hidden *bool) ([]ServiceDocumentContent, error) { + var m struct { + Payload struct { + Service struct { + Documents ServiceDocumentsContentConnection `graphql:"documents(searchTerm: $searchTerm, type: $type, hidden: $hidden)"` + } + } `graphql:"service(service: $service)"` + } + v := PayloadVariables{ + "service": *NewIdentifier(service), + "searchTerm": &searchTerm, + "type": docType, + "hidden": hidden, + } + err := client.Query(&m, v, WithName("ServiceDocumentSearch")) + return m.Payload.Service.Documents.Nodes, err +} diff --git a/input.go b/input.go index 5abedea7..d898e3f3 100644 --- a/input.go +++ b/input.go @@ -936,6 +936,7 @@ type ServiceCreateInput struct { OwnerInput *IdentifierInput `json:"ownerInput,omitempty" yaml:"owner,omitempty"` // The owner for this service. (Optional.) LifecycleAlias *string `json:"lifecycleAlias,omitempty" yaml:"lifecycle,omitempty" example:"example_alias"` // The lifecycle stage of the service. (Optional.) SkipAliasesValidation *bool `json:"skipAliasesValidation,omitempty" yaml:"skipAliasesValidation,omitempty" example:"false"` // Allows for the creation of a service with invalid aliases. (Optional.) + Type *IdentifierInput `json:"type,omitempty" yaml:"type,omitempty"` // The type of the component. (Optional.) } // ServiceDeleteInput specifies the input fields used in the `serviceDelete` mutation. @@ -991,6 +992,7 @@ type ServiceUpdateInput struct { OwnerInput *IdentifierInput `json:"ownerInput,omitempty" yaml:"owner,omitempty"` // The owner for the service. (Optional.) LifecycleAlias *string `json:"lifecycleAlias,omitempty" yaml:"lifecycle,omitempty" example:"example_alias"` // The lifecycle stage of the service. (Optional.) SkipAliasesValidation *bool `json:"skipAliasesValidation,omitempty" yaml:"skipAliasesValidation,omitempty" example:"false"` // Allows updating a service with invalid aliases. (Optional.) + Type *IdentifierInput `json:"type,omitempty" yaml:"type,omitempty"` // The type of the component. (Optional.) } // SystemInput specifies the input fields for a system. diff --git a/service.go b/service.go index 62b4abfa..08fbc392 100644 --- a/service.go +++ b/service.go @@ -12,6 +12,12 @@ type ServiceId struct { Aliases []string `json:"aliases,omitempty"` } +type ComponentType struct { + Id ID `json:"id"` + Alias string `json:"alias,omitempty"` + Aliases []string `json:"aliases,omitempty"` +} + // TODO: Lifecycle, TeamId, Tier should probably be pointers. type Service struct { ApiDocumentPath string `json:"apiDocumentPath,omitempty"` @@ -36,6 +42,7 @@ type Service struct { Tier Tier `json:"tier,omitempty"` Timestamps Timestamps `json:"timestamps"` Tools *ToolConnection `json:"tools,omitempty"` + Type *ComponentType `json:"type,omitempty"` Dependencies *ServiceDependenciesConnection `graphql:"-"` Dependents *ServiceDependentsConnection `graphql:"-"`