pallet_schemas_runtime_api/
lib.rs

1#![cfg_attr(not(feature = "std"), no_std)]
2#![allow(clippy::too_many_arguments)]
3#![allow(clippy::unnecessary_mut_passed)]
4#![allow(rustdoc::bare_urls)]
5// Strong Documentation Lints
6#![deny(
7	rustdoc::broken_intra_doc_links,
8	rustdoc::missing_crate_level_docs,
9	rustdoc::invalid_codeblock_attributes,
10	missing_docs
11)]
12
13//! Runtime API definition for [Schemas](../pallet_schemas/index.html)
14//!
15//! This api must be implemented by the node runtime.
16//! Runtime APIs Provide:
17//! - An interface between the runtime and Custom RPCs.
18//! - Runtime interfaces for end users beyond just State Queries
19
20use common_primitives::schema::*;
21extern crate alloc;
22use alloc::vec::Vec;
23
24sp_api::decl_runtime_apis! {
25
26	/// Runtime Version for Schemas
27	/// - See: https://paritytech.github.io/polkadot/doc/polkadot_primitives/runtime_api/index.html
28	// TODO: When deprecated methods are removed, bump base version
29	#[api_version(2)]
30
31	/// Runtime API definition for [Schemas](../pallet_schemas/index.html)
32	pub trait SchemasRuntimeApi
33	{
34		/// Fetch the schema by id
35		// TODO: Deprecated method; keep in place until all RPC nodes have been upgraded to remove the custom RPC `get_by_schema_id`
36		#[deprecated(note = "Please use get_schema_by_id")]
37		fn get_by_schema_id(schema_id: SchemaId) -> Option<SchemaResponse>;
38
39		/// Fetch the schema by id
40		#[api_version(3)]
41		fn get_schema_by_id(schema_id: SchemaId) -> Option<SchemaResponseV2>;
42
43		/// Fetch the schema versions by name
44		// TODO: Deprecated method; keep in place until all RPC nodes have been upgraded to remove the custom RPC `get_versions`
45		#[deprecated(note = "Schemas no longer have names; use get_registered_entities_by_name instead")]
46		fn get_schema_versions_by_name(schema_name: Vec<u8>) -> Option<Vec<SchemaVersionResponse>>;
47
48		/// Fetch registered entity identifiers by name
49		#[api_version(3)]
50		fn get_registered_entities_by_name(name: Vec<u8>) -> Option<Vec<NameLookupResponse>>;
51
52		/// Fetch the Intent by id
53		#[api_version(3)]
54		fn get_intent_by_id(intent_id: IntentId, include_schemas: bool) -> Option<IntentResponse>;
55
56		/// Fetch the IntentGroup by id
57		#[api_version(3)]
58		fn get_intent_group_by_id(intent_group_id: IntentGroupId) -> Option<IntentGroupResponse>;
59	}
60}