aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Edgecumbe <git@esotericnonsense.com>2019-10-27 03:44:48 +0100
committerDaniel Edgecumbe <git@esotericnonsense.com>2019-10-27 03:44:48 +0100
commitd8893e752b4799e30651279e7786cb32db336c49 (patch)
tree4c896fddd6b3db7ee33a27e5e690c74289dd5a70
parent0ac0a05b49ca2a2eaac40f4cf8119df53a9e1383 (diff)
A few more docstrings, restrict BFClient.req() usage
-rw-r--r--src/client.rs7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/client.rs b/src/client.rs
index faca372..4b1dff3 100644
--- a/src/client.rs
+++ b/src/client.rs
@@ -34,6 +34,7 @@ struct LoginResponse {
loginStatus: String, // TODO enum this
}
+/// A container for the essential credentials required for the Betfair APING.
pub struct BFCredentials {
username: String,
password: String,
@@ -56,7 +57,6 @@ impl BFCredentials {
app_key,
})
}
-
fn as_login_request_form(&self) -> LoginRequestForm {
LoginRequestForm {
username: self.username.clone(),
@@ -71,6 +71,8 @@ impl BFCredentials {
}
}
+/// A thread-safe client with automatic login implementing all methods of the
+/// Betfair APING.
pub struct BFClient {
client: reqwest::Client,
session_token: Arc<RwLock<Option<String>>>,
@@ -158,8 +160,7 @@ impl BFClient {
}
}
- /// Perform a request, logging in if necessary, fail if login
- pub fn req<T1: Serialize, T2: DeserializeOwned>(
+ pub(super) fn req<T1: Serialize, T2: DeserializeOwned>(
&self,
req: RpcRequest<T1>,
) -> Result<RpcResponse<T2>> {