-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: refactor subgraph list (#640)
- Loading branch information
1 parent
522d624
commit 02a8e14
Showing
6 changed files
with
73 additions
and
45 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
...er-client/src/query/subgraph/list.graphql → ...rc/query/subgraph/list/list_query.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
mod query_runner; | ||
|
||
pub(crate) mod types; | ||
|
||
pub use query_runner::run; | ||
pub use types::{SubgraphListInput, SubgraphListResponse}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
use crate::query::subgraph::list::query_runner::subgraph_list_query; | ||
|
||
pub(crate) type QuerySubgraphInfo = subgraph_list_query::SubgraphListQueryServiceImplementingServicesOnFederatedImplementingServicesServices; | ||
pub(crate) type QueryResponseData = subgraph_list_query::ResponseData; | ||
pub(crate) type QueryGraphType = subgraph_list_query::SubgraphListQueryServiceImplementingServices; | ||
|
||
type QueryVariables = subgraph_list_query::Variables; | ||
|
||
use chrono::{DateTime, Local}; | ||
|
||
#[derive(Clone, PartialEq, Debug)] | ||
pub struct SubgraphListInput { | ||
pub graph_id: String, | ||
pub variant: String, | ||
} | ||
|
||
impl From<SubgraphListInput> for QueryVariables { | ||
fn from(input: SubgraphListInput) -> Self { | ||
Self { | ||
graph_id: input.graph_id, | ||
variant: input.variant, | ||
} | ||
} | ||
} | ||
|
||
#[derive(Clone, PartialEq, Debug)] | ||
pub struct SubgraphListResponse { | ||
pub subgraphs: Vec<SubgraphInfo>, | ||
pub root_url: String, | ||
pub graph_name: String, | ||
} | ||
|
||
#[derive(Clone, PartialEq, Debug)] | ||
pub struct SubgraphInfo { | ||
pub name: String, | ||
pub url: Option<String>, // optional, and may not be a real url | ||
pub updated_at: Option<DateTime<Local>>, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters