aboutsummaryrefslogtreecommitdiff
path: root/src/call
diff options
context:
space:
mode:
Diffstat (limited to 'src/call')
-rw-r--r--src/call/account.rs12
-rw-r--r--src/call/mod.rs6
2 files changed, 18 insertions, 0 deletions
diff --git a/src/call/account.rs b/src/call/account.rs
index f35ab00..865baf6 100644
--- a/src/call/account.rs
+++ b/src/call/account.rs
@@ -1,3 +1,5 @@
+use super::Call;
+
use std::collections::BTreeMap;
// Contains login information. Used to create an API session.
@@ -19,6 +21,11 @@ impl From<Login<'_>> for xmlrpc::Value {
}
}
+impl Call for Login<'_> {
+ fn method_name(&self) -> &'static str { "account.login" }
+ fn expected(&self) -> &'static [i32] { &[1000] }
+}
+
// Contains no information. This just signals to the server
// that it should end the session.
pub(crate) struct Logout;
@@ -28,3 +35,8 @@ impl From<Logout> for xmlrpc::Value {
xmlrpc::Value::Nil
}
}
+
+impl Call for Logout {
+ fn method_name(&self) -> &'static str { "account.logout" }
+ fn expected(&self) -> &'static [i32] { &[1500] }
+}
diff --git a/src/call/mod.rs b/src/call/mod.rs
index b0edc6c..83de339 100644
--- a/src/call/mod.rs
+++ b/src/call/mod.rs
@@ -1 +1,7 @@
+// A call to the API.
+pub trait Call: Into<xmlrpc::Value> {
+ fn method_name(&self) -> &'static str;
+ fn expected(&self) -> &'static [i32];
+}
+
pub mod account;