pub struct GraphqlStreamConfig {
pub endpoint: String,
pub query: String,
pub variables: Value,
pub auth: AuthSpec<GraphqlAuth>,
pub headers: HeaderMap,
pub records_path: Option<String>,
pub pagination: Option<GraphqlPaginationSpec>,
pub max_pages: Option<usize>,
pub batch_size: usize,
pub tls: Option<TlsClientConfig>,
}Expand description
Configuration for the GraphQL source.
Fields§
§endpoint: StringGraphQL endpoint URL.
query: StringThe GraphQL query string.
variables: ValueVariables to pass with the query.
auth: AuthSpec<GraphqlAuth>Authentication: either inline ({ type, config }) or a { ref: <name> }
pointer to a shared provider in the CLI’s top-level auth: catalog.
headers: HeaderMapAdditional request headers.
records_path: Option<String>JSONPath expression to extract records from the response.
pagination: Option<GraphqlPaginationSpec>Pagination configuration. None for single-page queries. Accepts either
the Relay cursor block (no type:) or an offset block (type: Offset) —
see GraphqlPaginationSpec.
max_pages: Option<usize>Maximum number of pages to fetch.
batch_size: usizeRecords per emitted StreamPage, and the
value injected as the GraphQL first: cursor argument (or whatever
variable name GraphqlPagination::page_size_variable specifies).
Defaults to DEFAULT_BATCH_SIZE.
batch_size = 0 is the “no batching” sentinel: the page-size variable
is omitted from the request so the upstream uses its own default page
size, and the entire result set is emitted as a single page. If the
upstream schema requires a non-null first: argument this will
surface as FaucetError::Config at stream-time.
tls: Option<TlsClientConfig>Optional client-certificate (mutual TLS) config. When set, the source
presents a client certificate on every request (data + inline auth token
request). Requires the crate’s mtls feature.
Implementations§
Source§impl GraphqlStreamConfig
impl GraphqlStreamConfig
Sourcepub fn new(endpoint: impl Into<String>, query: impl Into<String>) -> Self
pub fn new(endpoint: impl Into<String>, query: impl Into<String>) -> Self
Create a new config with an endpoint and query.
Sourcepub fn tls(self, tls: TlsClientConfig) -> Self
pub fn tls(self, tls: TlsClientConfig) -> Self
Attach a mutual-TLS client identity (requires the mtls feature at build
time; otherwise GraphqlStream::try_new
errors).
Sourcepub fn auth(self, auth: GraphqlAuth) -> Self
pub fn auth(self, auth: GraphqlAuth) -> Self
Set the authentication method.
Sourcepub fn records_path(self, path: impl Into<String>) -> Self
pub fn records_path(self, path: impl Into<String>) -> Self
Set the JSONPath expression for record extraction.
Sourcepub fn pagination(self, pagination: GraphqlPagination) -> Self
pub fn pagination(self, pagination: GraphqlPagination) -> Self
Enable cursor-based (Relay) pagination with the given configuration.
Sourcepub fn offset_pagination(self, pagination: GraphqlOffsetPagination) -> Self
pub fn offset_pagination(self, pagination: GraphqlOffsetPagination) -> Self
Enable offset-into-variable pagination (ShopifyQL and similar).
Sourcepub fn with_batch_size(self, batch_size: usize) -> Self
pub fn with_batch_size(self, batch_size: usize) -> Self
Set the per-page record count for Source::stream_pages
and the GraphQL first: cursor argument.
Pass 0 to opt out of batching — the page-size variable is omitted
from the request so the upstream uses its own default page size, and
the response is emitted as a single StreamPage.
Sourcepub fn validate(&self) -> Result<(), FaucetError>
pub fn validate(&self) -> Result<(), FaucetError>
Validate the config at load time so a bad config fails fast with a typed
FaucetError::Config instead of surfacing deep in a run: rejects an
out-of-range batch_size (> MAX_BATCH_SIZE) and an empty endpoint or
query.
Trait Implementations§
Source§impl Clone for GraphqlStreamConfig
impl Clone for GraphqlStreamConfig
Source§fn clone(&self) -> GraphqlStreamConfig
fn clone(&self) -> GraphqlStreamConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for GraphqlStreamConfig
impl Debug for GraphqlStreamConfig
Source§impl<'de> Deserialize<'de> for GraphqlStreamConfig
impl<'de> Deserialize<'de> for GraphqlStreamConfig
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for GraphqlStreamConfig
impl JsonSchema for GraphqlStreamConfig
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read more