graphql

GitHub GraphQL API support for ghapi

GhGql Client

The GhGql class provides a lazy-loaded GraphQL client. The schema is fetched on first use, not at import time.

Module-level convenience functions

These use a default client instance, similar to how powertools works.

Examples

# List available query types
list_queries()[:10]
# See what args a query takes
query_args('repository')
# See fields on a type
type_fields('Repository')[:10]
# Execute a query
gh_query('''
query($owner: String!, $name: String!) {
  repository(owner: $owner, name: $name) {
    description
    stargazerCount
  }
}
''', {'owner': 'AnswerDotAI', 'name': 'ghapi'})