Skip to content

Commit 5d0582c

Browse files
authored
Remove unused generic client (#23)
Simplify implementation of client. This should have been removed when we removed the mock client.
1 parent d52781b commit 5d0582c

File tree

4 files changed

+5
-13
lines changed

4 files changed

+5
-13
lines changed

src/clients.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@ use uuid::Uuid;
77
use crate::model::app_metadata::AppMetadata;
88
use crate::model::metadata::Root;
99

10-
pub trait Client {
11-
fn app_metadata(&self) -> impl Future<Output = Result<AppMetadata, ClientError>> + Send;
12-
fn run_metadata(&self, id: Uuid) -> impl Future<Output = Result<Root, ClientError>> + Send;
13-
}
14-
1510
pub type ClientResult<T> = Result<T, ClientError>;
1611

1712
pub struct TiledClient {
@@ -26,12 +21,10 @@ impl TiledClient {
2621
let body = response.text().await?;
2722
serde_json::from_str(&body).map_err(|e| ClientError::InvalidResponse(e, body))
2823
}
29-
}
30-
impl Client for TiledClient {
31-
async fn app_metadata(&self) -> ClientResult<AppMetadata> {
24+
pub async fn app_metadata(&self) -> ClientResult<AppMetadata> {
3225
self.request::<AppMetadata>("/api/v1/").await
3326
}
34-
async fn run_metadata(&self, id: Uuid) -> ClientResult<Root> {
27+
pub async fn run_metadata(&self, id: Uuid) -> ClientResult<Root> {
3528
self.request::<Root>(&format!("/api/v1/metadata/{id}"))
3629
.await
3730
}

src/handlers.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,9 @@ use async_graphql_axum::{GraphQLRequest, GraphQLResponse};
44
use axum::Extension;
55
use axum::response::{Html, IntoResponse};
66

7-
use crate::clients::Client;
87
use crate::model::TiledQuery;
98

10-
pub async fn graphql_handler<T: Client + Send + Sync + 'static>(
9+
pub async fn graphql_handler(
1110
schema: Extension<Schema<TiledQuery, EmptyMutation, EmptySubscription>>,
1211
req: GraphQLRequest,
1312
) -> GraphQLResponse {

src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ async fn serve(config: GlazedConfig) -> Result<(), Box<dyn error::Error>> {
4141
.finish();
4242

4343
let app = Router::new()
44-
.route("/graphql", post(graphql_handler::<TiledClient>))
44+
.route("/graphql", post(graphql_handler))
4545
.route("/graphiql", get(graphiql_handler))
4646
.layer(Extension(schema));
4747

src/model.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ pub(crate) mod metadata;
55
use async_graphql::Object;
66
use uuid::Uuid;
77

8-
use crate::clients::{Client, ClientError, TiledClient};
8+
use crate::clients::{ClientError, TiledClient};
99

1010
pub(crate) struct TiledQuery(pub TiledClient);
1111

0 commit comments

Comments
 (0)