Documentation
¶
Overview ¶
Package example provides a handwritten GraphQL client for the Aha.io API. This package serves as example code for users learning to write GraphQL clients without code generation. For production use, see the generated client in github.com/grokify/aha-go/graphql/generated.
Index ¶
Constants ¶
const GetFeatureQuery = `
query GetFeature($id: ID!) {
feature(id: $id) {
name
description {
markdownBody
}
}
}
`
GetFeatureQuery is the GraphQL query for getting a feature by reference.
const GetPageQuery = `` /* 258-byte string literal not displayed */
GetPageQuery is the GraphQL query for getting a page by reference.
const GetRequirementQuery = `
query GetRequirement($id: ID!) {
requirement(id: $id) {
name
description {
markdownBody
}
}
}
`
GetRequirementQuery is the GraphQL query for getting a requirement by reference.
const SearchDocumentsQuery = `` /* 296-byte string literal not displayed */
SearchDocumentsQuery is the GraphQL query for searching documents.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a GraphQL client for Aha.io.
func NewClientWithHTTP ¶
NewClientWithHTTP creates a new GraphQL client with a custom HTTP client.
func (*Client) Query ¶
func (c *Client) Query(ctx context.Context, query string, variables map[string]any, result any) error
Query executes a GraphQL query and unmarshals the data into result.
func (*Client) SetEndpoint ¶
SetEndpoint sets a custom endpoint URL (for testing).
type Description ¶
type Description struct {
MarkdownBody string `json:"markdownBody"`
}
Description contains formatted content.
type DocumentNode ¶
type DocumentNode struct {
Name string `json:"name"`
URL string `json:"url"`
SearchableID string `json:"searchableId"`
SearchableType string `json:"searchableType"`
}
DocumentNode represents a search result document.
type Error ¶
type Error struct {
Message string `json:"message"`
Path []string `json:"path,omitempty"`
Extensions any `json:"extensions,omitempty"`
}
Error represents a GraphQL error.
type Feature ¶
type Feature struct {
Name string `json:"name"`
Description *Description `json:"description"`
}
Feature represents an Aha feature from GraphQL.
type FeatureResponse ¶
type FeatureResponse struct {
Feature *Feature `json:"feature"`
}
FeatureResponse is the response from the feature query.
type Page ¶
type Page struct {
Name string `json:"name"`
Description *Description `json:"description"`
Children []PageRef `json:"children"`
Parent *PageRef `json:"parent"`
}
Page represents an Aha page/note.
type PageResponse ¶
type PageResponse struct {
Page *Page `json:"page"`
}
PageResponse is the response from the page query.
type Request ¶
type Request struct {
Query string `json:"query"`
Variables map[string]any `json:"variables,omitempty"`
}
Request represents a GraphQL request.
type Requirement ¶
type Requirement struct {
Name string `json:"name"`
Description *Description `json:"description"`
}
Requirement represents an Aha requirement from GraphQL.
type RequirementResponse ¶
type RequirementResponse struct {
Requirement *Requirement `json:"requirement"`
}
RequirementResponse is the response from the requirement query.
type Response ¶
type Response struct {
Data json.RawMessage `json:"data"`
Errors []Error `json:"errors,omitempty"`
}
Response represents a GraphQL response.
type SearchDocumentsResponse ¶
type SearchDocumentsResponse struct {
SearchDocuments SearchResults `json:"searchDocuments"`
}
SearchDocumentsResponse is the response from the searchDocuments query.
type SearchResults ¶
type SearchResults struct {
Nodes []DocumentNode `json:"nodes"`
CurrentPage int `json:"currentPage"`
TotalCount int `json:"totalCount"`
TotalPages int `json:"totalPages"`
IsLastPage bool `json:"isLastPage"`
}
SearchResults contains paginated search results.