Skip to main content

vantage_sdk.gql_client

Modern GraphQL client implementation using the gql library.

Classes

AuthenticationError(message: 'str', *args: 'Any', base_message: 'str | None' = None, **kwargs: 'Any')

Authentication-related errors.

GraphQLClientConfig(url: str, timeout: int = 30, verify_ssl: bool = True, max_retries: int = 3, retry_backoff_factor: float = 0.5, retry_status_codes: Tuple[int, ...] = (429, 500, 502, 503, 504), fetch_schema: bool = True, validate_queries: bool = True, enable_logging: bool = True, log_queries: bool = False, headers: Dict[str, str] = <factory>, transport_type: vantage_sdk.gql_client.TransportType = <TransportType.AIOHTTP: 'aiohttp'>) -> None

Configuration for GraphQL client.

GraphQLError(message: str, query: str | None = None, variables: Dict[str, Any] | None = None, errors: List[Dict[str, Any]] | None = None, extensions: Dict[str, Any] | None = None)

GraphQL-specific error.

QueryMetrics(query_name: str, execution_time_ms: float, success: bool, error_type: str | None = None, retry_count: int = 0) -> None

Metrics for a GraphQL query execution.

TransportType(*values)

Available transport types for GraphQL client.

VantageGQLClient(settings: vantage_sdk.config.Settings, persona: vantage_sdk.schemas.Persona, profile: str = 'default', base_path: str = '/cluster/graphql')

Factory class for creating GraphQL clients for different Vantage API endpoints.

Methods

  • create(self) -> vantage_sdk.gql_client.VantageGraphQLClient: Create an async GraphQL client with the configured settings.

VantageGraphQLClient(config: vantage_sdk.gql_client.GraphQLClientConfig, persona: vantage_sdk.schemas.Persona | None = None, profile: str = 'default', settings: vantage_sdk.config.Settings | None = None)

Production-ready GraphQL client with comprehensive features.

Methods

  • clear_metrics(self) -> None: Clear query execution metrics.
  • execute_async(self, query: str, variables: Dict[str, Any] | None = None, require_auth: bool = True) -> Dict[str, Any]: Execute a GraphQL query asynchronously.
  • get_metrics(self) -> List[vantage_sdk.gql_client.QueryMetrics]: Get query execution metrics.
  • get_schema(self) -> Any | None: Get the GraphQL schema if available.
  • health_check(self) -> bool: Perform a basic health check by executing a simple introspection query.

Functions

create_async_graphql_client(settings: vantage_sdk.config.Settings, persona: vantage_sdk.schemas.Persona, profile: str = 'default')

Create an async GraphQL client for the cluster endpoint.

create_development_client(url: str, persona: vantage_sdk.schemas.Persona | None = None, profile: str = 'default', settings: vantage_sdk.config.Settings | None = None, **config_overrides: Any) -> vantage_sdk.gql_client.VantageGraphQLClient

Create development GraphQL client with debugging features.

create_production_client(url: str, persona: vantage_sdk.schemas.Persona, profile: str = 'default', settings: vantage_sdk.config.Settings | None = None, **config_overrides: Any) -> vantage_sdk.gql_client.VantageGraphQLClient

Create production-ready GraphQL client with optimal settings.

create_vantage_graphql_client(url: str, persona: vantage_sdk.schemas.Persona | None = None, transport_type: vantage_sdk.gql_client.TransportType = <TransportType.AIOHTTP: 'aiohttp'>, profile: str = 'default', settings: vantage_sdk.config.Settings | None = None, **config_overrides: Any) -> vantage_sdk.gql_client.VantageGraphQLClient

Create a VantageGraphQLClient with sensible defaults.