aboutsummaryrefslogtreecommitdiffstats
path: root/src/abconfig.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/abconfig.rs')
-rw-r--r--src/abconfig.rs21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/abconfig.rs b/src/abconfig.rs
index 7957dea..294467a 100644
--- a/src/abconfig.rs
+++ b/src/abconfig.rs
@@ -15,15 +15,20 @@
// along with this program. If not, see <https://www.gnu.org/licenses/>.
use crate::{client::Client, error::Error};
+use serde::Deserialize;
-pub struct ABConfig;
-
-pub fn abconfig() -> ABConfig {
- ABConfig {}
+#[derive(Debug, Deserialize)]
+pub struct ABConfig {
+ pub id: u32,
+ pub chan: u32,
+ pub xchan: String,
+ pub cat: String,
+ pub k: String,
+ pub v: String,
}
-impl ABConfig {
- pub fn fetch(&self, client: &Client) -> Result<String, Error> {
- client.fetch_stream("abconfig", &())
- }
+pub fn fetch(client: &Client) -> Result<Vec<ABConfig>, Error> {
+ let payload = client.fetch_stream("abconfig", &())?;
+ Ok(serde_json::from_str(&payload)?)
}
+