diff --git a/src/api/helper.rs b/src/api/helper.rs index 74b3d21..3401bd3 100644 --- a/src/api/helper.rs +++ b/src/api/helper.rs @@ -11,6 +11,7 @@ const MAX_RPC_BODY_LEN: usize = 65536; #[derive(Debug)] pub enum ApiMethod { + GetSubset, Publish, WhoAmI, Get, @@ -25,6 +26,7 @@ impl ApiMethod { pub fn selector(&self) -> &'static [&'static str] { use ApiMethod::*; match self { + GetSubset => &["partialReplication", "getSubset"], Publish => &["publish"], WhoAmI => &["whoami"], Get => &["get"], @@ -38,6 +40,7 @@ impl ApiMethod { pub fn from_selector(s: &[&str]) -> Option { use ApiMethod::*; match s { + ["partialReplication", "getSubset"] => Some(GetSubset), ["publish"] => Some(Publish), ["whoami"] => Some(WhoAmI), ["get"] => Some(Get), @@ -68,6 +71,15 @@ impl ApiCaller { &mut self.rpc } + /// Send ["partialReplication", "getSubset"] request. + pub async fn getsubset_req_send(&mut self, query: SubsetQuery) -> Result { + let req_no = self + .rpc + .send_request(ApiMethod::GetSubset.selector(), RpcType::Source, &query) + .await?; + Ok(req_no) + } + /// Send ["publish"] request. pub async fn publish_req_send(&mut self, msg: TypedMessage) -> Result { let req_no = self