use crate::ast;
use crate::operation::FragmentRegistry;
use crate::types::GraphQLType;
use crate::DirectiveAnnotation;
use crate::loc;
use crate::operation::OperationTrait;
use crate::operation::OperationData;
use crate::operation::SelectionSet;
use crate::operation::SubscriptionBuilder;
use crate::operation::SubscriptionBuildError;
use crate::operation::Variable;
use crate::schema::Schema;
use indexmap::IndexMap;
use inherent::inherent;
#[derive(Clone, Debug, PartialEq)]
pub struct Subscription<'schema: 'fragreg, 'fragreg>(
pub(super) OperationData<'schema, 'fragreg>,
);
#[inherent]
impl<'schema: 'fragreg, 'fragreg> OperationTrait<
'schema,
'fragreg,
ast::operation::Subscription,
SubscriptionBuildError,
SubscriptionBuilder<'schema, 'fragreg>,
> for Subscription<'schema, 'fragreg> {
pub fn builder(
schema: &'schema Schema,
fragment_registry: &'fragreg FragmentRegistry<'schema>,
) -> SubscriptionBuilder<'schema, 'fragreg> {
SubscriptionBuilder::new(schema, fragment_registry)
}
pub fn directives(&self) -> &Vec<DirectiveAnnotation> {
&self.0.directives
}
pub fn def_location(&self) -> &loc::SourceLocation {
&self.0.def_location
}
pub fn name(&self) -> Option<&str> {
self.0.name.as_deref()
}
pub fn root_graphql_type(&self, schema: &'schema Schema) -> &GraphQLType {
schema.subscription_type().unwrap()
}
pub fn selection_set(&self) -> &SelectionSet<'fragreg> {
&self.0.selection_set
}
pub fn variables(&self) -> &IndexMap<String, Variable> {
&self.0.variables
}
}