56 Commits

Author SHA1 Message Date
Ragotzy.devin
800fba7c32
Implement PresenceEvent and EphemeralEvent
* Add derive for PresenceEventContent and create struct AnyPresenceEventContent
since there is only one content type
* Add derive for Ephemeral event and create enum AnyEphemeralEventContent, convert
receipt and typing to use derive(EphemeralEventContent) over ruma_api!
2020-06-07 22:56:43 +02:00
Ragotzy.devin
3d01bfa96d
Remove Event, RoomEvent and StateEvent traits 2020-06-07 01:02:49 +02:00
Jonas Platte
c1ee72db0f
Use PresenceState from ruma_common 2020-06-04 21:15:14 +02:00
Jonas Platte
61e6493432
Sort derives by crate 2020-06-04 21:03:34 +02:00
Jake Waksbaum
e05fdf84fd
Replace serde/strum renames with rename_all
Instead of applying a `#[serde(rename = "foo")]` or `#[strum(serialize =
"foo")]` to each field of a struct or variants of an enum, apply the
appropriate `#[serde(rename_all = "style")]` or `#[strum(serialize_all =
"style")]` to the struct/enum.

In addition, in the places where the `lowercase` style is used and all
the fields/variants are a single word, replace that with `snake_case`,
since that seems to be the default everywhere with multi-word
fields/variants.
2020-05-29 10:59:33 -04:00
Jake Waksbaum
d84de004c8
Replace impl_enum with strum::{EnumString,Display}
Replace the impl_enum! macro, which automatically derives instances of
std::fmt::Display and std::string::FromStr, with derive macros from the
strum crate (Display and EnumString resp.).

Closes #90.
2020-05-29 10:59:33 -04:00
Jonas Platte
17faaaa56e
Bump MSRV to 1.40.0 2020-05-02 22:14:05 +02:00
Jonas Platte
8e4ff82a83
Stop relying on PartialEq for tests 2020-05-02 00:17:41 +02:00
Jonas Platte
fd5527da78
Reorder derives (std first) 2020-04-29 22:22:42 +02:00
Jonas Platte
eb3a3e2163
Replace EventResult with EventJson, simplify InvalidEvent 2020-04-22 21:24:39 +02:00
Akshay
8915339e56
Rewrite tests to use serde_json::json! instead of raw strings 2020-03-31 16:07:09 +02:00
Akshay
f09ab98f17
Remove manual Serialize impl, use derive macro instead 2020-03-29 13:41:42 +02:00
Ragotzy.devin
8ea971b082
Derive Serialize in ruma_events!, use json EventType string for event_type field
Co-authored-by: Jonas Platte <jplatte+git@posteo.de>
2020-03-24 14:25:50 +01:00
Jonas Platte
777f3b9686 Re-run rustfmt 2019-10-22 23:52:44 +02:00
Jonas Platte
05562a48a3 WIP 2019-09-29 13:30:51 +02:00
Jimmy Cuadra
38492dd09e Split presence serialization/deserialization tests into two test cases. 2019-07-23 01:31:03 -07:00
Jimmy Cuadra
eaddc6dce2 Use str::parse for conversion from JSON. 2019-07-19 14:42:57 -07:00
Jimmy Cuadra
4be050b19a Convert m.tag and m.typing to the new API. 2019-07-19 14:35:21 -07:00
Jimmy Cuadra
1f3e33c77d Convert m.dummy, m.forwarded_room_key, m.presence, m.room_key_request,
and m.sticker to the new API.
2019-07-19 14:33:40 -07:00
Jimmy Cuadra
c3f48c5be3 Use js_int types for numbers.
Closes #27.
2019-06-16 16:16:37 -07:00
Jimmy Cuadra
9b17d5729a Use a consistent style for the name of the library. 2019-06-15 00:07:44 -07:00
Jimmy Cuadra
12212789b3 Future-proof enums with a __Nonexhaustive variant.
This can be replaced with the #[non_exhaustive] compiler attribute once
it's stabilized.
2019-06-14 18:18:47 -07:00
Jimmy Cuadra
8b6aeddcd6 Fix broken tests. 2019-06-13 17:48:52 -07:00
Jimmy Cuadra
7eb9384bd6 Add status_msg field to m.presence. 2019-06-13 17:44:49 -07:00
Jimmy Cuadra
ba2538dda9 Update existing events for spec r0.5.0 and add m.fully_read and
m.room.message.feedback.
2019-06-12 16:20:10 -07:00
Jonas Platte
7f18e1c32e Replace serde_derive by re-exports in serde 2019-02-06 20:12:30 +01:00
Jonas Platte
1b2cd339cb Update to Rust 2018 2019-01-16 00:13:10 +01:00
Jonas Platte
6f093f70ed Use nested imports, misc. import changes
* Bring imports into a consistent order (std, crates, internal)
* Replace super::super-imports by crate-relative ones
2019-01-16 00:13:10 +01:00
Florian Jacob
af3a14e3b4 Apply upcoming spec change to m.presence event representation,
making ruma-client more interoperable with synapse.
See https://github.com/matrix-org/matrix-doc/pull/1137 for the details
of the spec change.
Fixes https://github.com/ruma/ruma-client-api/issues/27
2018-09-01 12:22:30 +02:00
Jimmy Cuadra
3acc5c3a93 Run rustfmt. 2018-05-18 23:54:13 -07:00
Konstantinos Sideris
a9490dbee8 Update matrix events to their latest version 2017-11-16 11:22:07 +02:00
Jonas Platte
4a91932ea8 Fix a bunch more deserialization bugs 2017-08-03 22:16:52 +02:00
Jonas Platte
491188db2b Make PresenceEventContent::currently_active optional 2017-07-12 18:28:26 +10:00
Konstantinos Sideris
968aae4230 Add missing trait implementations for PresenceState 2017-01-05 15:11:10 +02:00
Jimmy Cuadra
f57a1aec48 Derive Clone for basically everything. Close #3." 2016-10-16 16:20:25 -07:00
Jimmy Cuadra
8392852741 Convert Event, RoomEvent and StateEvent into traits. 2016-10-02 03:46:16 -07:00
Jimmy Cuadra
f3acdfd141 Reintroduce macro for enum Display and FromStr impls. 2016-10-01 04:25:45 -07:00
Jimmy Cuadra
2eb07f5abd Use Serde annotations instead of manual implementation for enums. 2016-08-03 23:43:08 -07:00
Jimmy Cuadra
f35f2015eb Skip serializing option values that are none. 2016-08-03 03:47:03 -07:00
Jimmy Cuadra
1e1079a904 Extract enum serialization into a macro. 2016-07-30 11:50:58 -07:00
Jimmy Cuadra
d11ef217a2 Factor the custom Serde Visitor out into a generic type. 2016-07-29 17:37:08 -07:00
Jimmy Cuadra
cd59bf1e2d Implement Serialize and Deserialize for PresenceState. 2016-07-29 16:33:14 -07:00
Jimmy Cuadra
5326091981 Use ruma-identifiers types for ID values. 2016-07-28 03:04:07 -07:00
Jimmy Cuadra
070a6fe633 Add second generic parameter to events and add missing docs. 2016-07-02 03:33:10 -07:00
Jimmy Cuadra
b0b7a3e6ea Remove EventKind trait. 2016-07-02 01:26:22 -07:00
Jimmy Cuadra
b84fc9b23e Add EventKind trait. 2016-06-23 04:13:43 -07:00
Jimmy Cuadra
68265a9387 Revert the package name to ruma-events. 2016-06-21 21:29:43 -07:00
Jimmy Cuadra
dd1a3979e6 Rename package to ruma-common and namespace event types. 2016-06-20 22:47:51 -07:00
Jimmy Cuadra
09ecdfa470 Derive Debug and {De,}Serialize for all types. 2016-06-04 03:09:32 -07:00
Jimmy Cuadra
d525766c99 Make all fields public. 2016-06-04 02:57:24 -07:00