reactive_graph_runtime_graphql_schema/query/
instance.rs

1use async_graphql::Object;
2
3use reactive_graph_remotes_model::InstanceInfo;
4
5pub struct GraphQLInstanceInfo {
6    /// The instance information.
7    pub instance_info: InstanceInfo,
8}
9
10#[Object(name = "InstanceInfo")]
11impl GraphQLInstanceInfo {
12    async fn name(&self) -> String {
13        self.instance_info.name.clone()
14    }
15
16    async fn description(&self) -> String {
17        self.instance_info.description.clone()
18    }
19
20    async fn hostname(&self) -> String {
21        self.instance_info.address.hostname.clone()
22    }
23
24    async fn port(&self) -> u16 {
25        self.instance_info.address.port
26    }
27
28    async fn secure(&self) -> bool {
29        self.instance_info.address.secure
30    }
31
32    async fn version(&self) -> String {
33        self.instance_info.version.clone()
34    }
35
36    async fn git_commit(&self) -> String {
37        self.instance_info.git_commit.clone()
38    }
39
40    async fn git_tag(&self) -> String {
41        self.instance_info.git_tag.clone()
42    }
43
44    async fn rustc_channel(&self) -> String {
45        self.instance_info.rustc_channel.clone()
46    }
47
48    async fn rustc_version(&self) -> String {
49        self.instance_info.rustc_version.clone()
50    }
51
52    async fn plugin_api_version(&self) -> String {
53        self.instance_info.plugin_api_version.clone()
54    }
55
56    /// When the remote instance was last seen (ISO8601 / RFC3339).
57    async fn last_seen(&self) -> String {
58        self.instance_info.last_seen.to_rfc3339()
59    }
60}
61
62impl From<InstanceInfo> for GraphQLInstanceInfo {
63    fn from(instance_info: InstanceInfo) -> Self {
64        GraphQLInstanceInfo { instance_info }
65    }
66}