linera_sdk/
graphql.rs

1// Copyright (c) Zefchain Labs, Inc.
2// SPDX-License-Identifier: Apache-2.0
3
4//! GraphQL traits for generating interfaces into applications.
5
6use std::sync::Arc;
7
8/// Re-exports the derive macro for [`GraphQLMutationRoot`].
9pub use linera_sdk_derive::GraphQLMutationRoot;
10
11use crate::{Service, ServiceRuntime};
12
13/// An object associated with a GraphQL mutation root. Those are typically used to build
14/// an [`async_graphql::Schema`] object.
15pub trait GraphQLMutationRoot<Application>
16where
17    Application: Service,
18{
19    /// The type of the mutation root.
20    type MutationRoot: async_graphql::ObjectType;
21
22    /// Returns the mutation root of the object.
23    fn mutation_root(runtime: Arc<ServiceRuntime<Application>>) -> Self::MutationRoot;
24}