| 60 | } |
| 61 | |
| 62 | fn build_gql_api_client(token: Option<&str>, api_url: String) -> GQLClient { |
| 63 | let headers = match token { |
| 64 | Some(token) => { |
| 65 | let mut headers = std::collections::HashMap::new(); |
| 66 | headers.insert("Authorization".to_string(), token.to_owned()); |
| 67 | headers |
| 68 | } |
| 69 | None => Default::default(), |
| 70 | }; |
| 71 | |
| 72 | GQLClient::new_with_config(ClientConfig { |
| 73 | endpoint: api_url, |
| 74 | // Slightly high to account for cold starts |
| 75 | timeout: Some(20), |
| 76 | headers: Some(headers), |
| 77 | proxy: None, |
| 78 | }) |
| 79 | } |
| 80 | |
| 81 | nest! { |
| 82 | #[derive(Debug, Deserialize, Serialize)]* |