Expand description
Generic GraphQL target plugin with a fluent builder API.
Use GenericGraphQlPlugin when you need a quick, ad-hoc plugin without
writing a dedicated implementation struct. Supply the endpoint, optional
auth, headers, and cost-throttle configuration via the builder.
§Example
use stygian_graph::adapters::graphql_plugins::generic::GenericGraphQlPlugin;
use stygian_graph::adapters::graphql_throttle::CostThrottleConfig;
use stygian_graph::ports::{GraphQlAuth, GraphQlAuthKind};
use stygian_graph::ports::graphql_plugin::GraphQlTargetPlugin;
let plugin = GenericGraphQlPlugin::builder()
.name("github")
.endpoint("https://api.github.com/graphql")
.auth(GraphQlAuth {
kind: GraphQlAuthKind::Bearer,
token: "${env:GITHUB_TOKEN}".to_string(),
header_name: None,
})
.header("X-Github-Next-Global-ID", "1")
.cost_throttle(CostThrottleConfig::default())
.page_size(30)
.description("GitHub GraphQL API")
.build()
.expect("required fields: name and endpoint");
assert_eq!(plugin.name(), "github");
assert_eq!(plugin.default_page_size(), 30);Structs§
- Generic
Graph QlPlugin - A fully generic GraphQL target plugin built via
GenericGraphQlPluginBuilder. - Generic
Graph QlPlugin Builder - Builder for
GenericGraphQlPlugin.
Enums§
- Build
Error - Errors that can occur when building a
GenericGraphQlPlugin.