Documentation
¶
Overview ¶
Package graphql provides a type-safe GraphQL client for the Aha.io API.
Use NewGenqlientClient and the functions in the generated subpackage:
import (
"github.com/grokify/aha-go/graphql"
"github.com/grokify/aha-go/graphql/generated"
)
client := graphql.NewGenqlientClient("mycompany", "api-key")
resp, err := generated.GetFeature(ctx, client, "FEAT-123")
For example code showing how to write a GraphQL client without code generation, see the github.com/grokify/aha-go/graphql/example package.
Index ¶
- func NewGenqlientClient(subdomain, apiKey string) genql.Client
- func NewGenqlientClientWithHTTP(subdomain, apiKey string, httpClient *http.Client) genql.Client
- func ValidateRequiredFields(requirements *ScreenRequirements, providedFields map[string]any) []string
- type CustomFieldDefinition
- type CustomFieldOption
- type FieldRequirement
- type ScreenRequirements
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewGenqlientClient ¶ added in v0.3.0
NewGenqlientClient creates a genqlient-compatible client for use with the generated query functions in the generated subpackage.
Example:
client := graphql.NewGenqlientClient("mycompany", "my-api-key")
resp, err := generated.GetFeature(ctx, client, "FEAT-123")
func NewGenqlientClientWithHTTP ¶ added in v0.3.0
NewGenqlientClientWithHTTP creates a genqlient-compatible client with a custom HTTP client for use with the generated query functions.
func ValidateRequiredFields ¶ added in v0.4.0
func ValidateRequiredFields(requirements *ScreenRequirements, providedFields map[string]any) []string
ValidateRequiredFields checks if all required fields are provided. Returns a list of missing required field IDs/keys.
Types ¶
type CustomFieldDefinition ¶ added in v0.4.0
type CustomFieldDefinition struct {
ID string
Key string
Name string
Type string
Options []CustomFieldOption
}
CustomFieldDefinition represents a custom field definition.
func GetProjectCustomFieldDefinitions ¶ added in v0.4.0
func GetProjectCustomFieldDefinitions(ctx context.Context, client genql.Client, projectID string) ([]CustomFieldDefinition, error)
GetProjectCustomFieldDefinitions fetches all custom field definitions for a project.
type CustomFieldOption ¶ added in v0.4.0
CustomFieldOption represents an option for choice-based custom fields.
type FieldRequirement ¶ added in v0.4.0
type FieldRequirement struct {
FieldID string
Required bool
ReadOnly bool
IsCustomField bool
CustomFieldKey string
CustomFieldName string
CustomFieldType string
}
FieldRequirement represents a field's requirement status.
type ScreenRequirements ¶ added in v0.4.0
type ScreenRequirements struct {
RecordType string
Fields []FieldRequirement
}
ScreenRequirements holds all field requirements for a screen/record type.
func GetFeatureRequirements ¶ added in v0.4.0
func GetFeatureRequirements(ctx context.Context, client genql.Client, featureID string) (*ScreenRequirements, error)
GetFeatureRequirements fetches the field requirements for features in a project. It requires an existing feature ID from the project to get the screen definition.
func (*ScreenRequirements) IsRequired ¶ added in v0.4.0
func (sr *ScreenRequirements) IsRequired(fieldIDOrKey string) bool
IsRequired checks if a field is required by ID or custom field key.
func (*ScreenRequirements) RequiredCustomFieldKeys ¶ added in v0.4.0
func (sr *ScreenRequirements) RequiredCustomFieldKeys() []string
RequiredCustomFieldKeys returns the keys of all required custom fields.
func (*ScreenRequirements) RequiredFieldIDs ¶ added in v0.4.0
func (sr *ScreenRequirements) RequiredFieldIDs() []string
RequiredFieldIDs returns the IDs of all required fields.