revamp appservice registration to ruma's Registration type

squashed from https://gitlab.com/famedly/conduit/-/merge_requests/583

Signed-off-by: strawberry <strawberry@puppygock.gay>
This commit is contained in:
Matthias Ahouansou 2024-02-07 17:48:01 -05:00 committed by June
parent 0e9eb22ee7
commit 784d307425
13 changed files with 203 additions and 208 deletions

View file

@ -1,6 +1,7 @@
mod data;
pub(crate) use data::Data;
use ruma::api::appservice::Registration;
use crate::Result;
@ -10,7 +11,7 @@ pub struct Service {
impl Service {
/// Registers an appservice and returns the ID to the caller
pub fn register_appservice(&self, yaml: serde_yaml::Value) -> Result<String> {
pub fn register_appservice(&self, yaml: Registration) -> Result<String> {
self.db.register_appservice(yaml)
}
@ -23,7 +24,7 @@ impl Service {
self.db.unregister_appservice(service_name)
}
pub fn get_registration(&self, id: &str) -> Result<Option<serde_yaml::Value>> {
pub fn get_registration(&self, id: &str) -> Result<Option<Registration>> {
self.db.get_registration(id)
}
@ -31,7 +32,7 @@ impl Service {
self.db.iter_ids()
}
pub fn all(&self) -> Result<Vec<(String, serde_yaml::Value)>> {
pub fn all(&self) -> Result<Vec<(String, Registration)>> {
self.db.all()
}
}