Update ruma-api to 0.14.0
This commit is contained in:
parent
a7ca7b1e8d
commit
8e9a6ffede
@ -8,6 +8,7 @@ Improvements:
|
||||
|
||||
Breaking changes:
|
||||
|
||||
* Update ruma-api to 0.14.0
|
||||
* Fix `r0::session::get_login_types`
|
||||
|
||||
# 0.6.0
|
||||
|
@ -15,9 +15,10 @@ edition = "2018"
|
||||
[dependencies]
|
||||
http = "0.2.0"
|
||||
js_int = { version = "0.1.2", features = ["serde"] }
|
||||
ruma-api = "0.13.0"
|
||||
ruma-api = "0.14.0"
|
||||
ruma-events = "0.15.1"
|
||||
ruma-identifiers = "0.14.1"
|
||||
serde = { version = "1.0.104", features = ["derive"] }
|
||||
serde_json = "1.0.47"
|
||||
strum = { version = "0.17.1", features = ["derive"] }
|
||||
url = { version = "2.1.1", features = ["serde"] }
|
||||
|
@ -1,6 +1,9 @@
|
||||
//! Endpoints for push notifications.
|
||||
|
||||
use std::fmt::{Display, Formatter, Result as FmtResult};
|
||||
use std::{
|
||||
convert::TryFrom,
|
||||
fmt::{Formatter, Result as FmtResult},
|
||||
};
|
||||
|
||||
use serde::{
|
||||
de::{Error as SerdeError, MapAccess, Unexpected, Visitor},
|
||||
@ -8,6 +11,7 @@ use serde::{
|
||||
Deserialize, Deserializer, Serialize, Serializer,
|
||||
};
|
||||
use serde_json::Value as JsonValue;
|
||||
use strum::{Display, EnumString};
|
||||
|
||||
pub mod delete_pushrule;
|
||||
pub mod get_notifications;
|
||||
@ -23,8 +27,9 @@ pub mod set_pushrule_actions;
|
||||
pub mod set_pushrule_enabled;
|
||||
|
||||
/// The kinds of push rules that are available
|
||||
#[derive(Clone, Copy, Debug, Serialize, Deserialize, Eq, PartialEq, Hash)]
|
||||
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash, Serialize, Deserialize, Display, EnumString)]
|
||||
#[serde(rename_all = "snake_case")]
|
||||
#[strum(serialize_all = "snake_case")]
|
||||
pub enum RuleKind {
|
||||
/// User-configured rules that override all other kinds
|
||||
Override,
|
||||
@ -42,16 +47,11 @@ pub enum RuleKind {
|
||||
Content,
|
||||
}
|
||||
|
||||
impl Display for RuleKind {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult {
|
||||
let s = match self {
|
||||
RuleKind::Override => "override",
|
||||
RuleKind::Underride => "underride",
|
||||
RuleKind::Sender => "sender",
|
||||
RuleKind::Room => "room",
|
||||
RuleKind::Content => "content",
|
||||
};
|
||||
write!(f, "{}", s)
|
||||
impl TryFrom<&'_ str> for RuleKind {
|
||||
type Error = strum::ParseError;
|
||||
|
||||
fn try_from(s: &str) -> Result<Self, Self::Error> {
|
||||
s.parse()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
//! [POST /_matrix/client/r0/rooms/{roomId}/receipt/{receiptType}/{eventId}](https://matrix.org/docs/spec/client_server/r0.4.0.html#post-matrix-client-r0-rooms-roomid-receipt-receipttype-eventid)
|
||||
|
||||
use std::fmt::{Display, Error as FmtError, Formatter};
|
||||
use std::convert::TryFrom;
|
||||
|
||||
use ruma_api::ruma_api;
|
||||
use ruma_identifiers::{EventId, RoomId};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use strum::{Display, EnumString};
|
||||
|
||||
ruma_api! {
|
||||
metadata {
|
||||
@ -32,17 +32,17 @@ ruma_api! {
|
||||
}
|
||||
|
||||
/// The type of receipt.
|
||||
#[derive(Clone, Copy, Debug, Deserialize, Serialize)]
|
||||
#[derive(Clone, Copy, Debug, Display, EnumString)]
|
||||
pub enum ReceiptType {
|
||||
/// m.read
|
||||
#[serde(rename = "m.read")]
|
||||
#[strum(serialize = "m.read")]
|
||||
Read,
|
||||
}
|
||||
|
||||
impl Display for ReceiptType {
|
||||
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), FmtError> {
|
||||
match *self {
|
||||
ReceiptType::Read => write!(f, "m.read"),
|
||||
}
|
||||
impl TryFrom<&'_ str> for ReceiptType {
|
||||
type Error = strum::ParseError;
|
||||
|
||||
fn try_from(s: &str) -> Result<Self, Self::Error> {
|
||||
s.parse()
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user