1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use async_trait::async_trait;
use url::Url;

/// Adapter to allow different HTTP clients to be used with the library, to properly implement this
/// trait, use [async_trait](https://crates.io/crates/async-trait).
#[async_trait]
pub trait HttpClientAdapter {
	/// Error type used by the underlying HTTP library
	type Error;

	/// Fetch the specified URL using the GET method
	///
	/// Returns the text contents of the resource located at the indicated URL
	async fn get(&self, url: Url) -> Result<String, Self::Error>;
}