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<GraphqlPagination>,
pub max_pages: Option<usize>,
pub batch_size: usize,
}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<GraphqlPagination>Pagination configuration. None for single-page queries.
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.
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 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 pagination with the given configuration.
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.
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