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