409 Commits

Author SHA1 Message Date
Jimmy Cuadra
7d1701ccce Implement FromStr for content types. 2019-07-19 14:56:38 -07:00
Jimmy Cuadra
8c8f1790f1 Clarify how InvalidInput differs from InvalidEvent. 2019-07-19 14:55:42 -07:00
Jimmy Cuadra
0f55729478 Handle both deserialization and validation errors in FromStr impls. 2019-07-19 14:54:31 -07:00
Jimmy Cuadra
4e363bc2c5 Convert m.key.verification.start to the new API. 2019-07-19 14:53:54 -07:00
Jimmy Cuadra
5c2e0e62a9 Implement Serialize for EncryptedEventContent. 2019-07-19 14:53:19 -07:00
Jimmy Cuadra
3e58ad7a8f Convert m.room.message to the new API. 2019-07-19 14:52:49 -07:00
Jimmy Cuadra
8b59318629 Sort the unsigned field alphabetically in Serialize impls. 2019-07-19 14:52:49 -07:00
Jimmy Cuadra
21351aaff0 Convert m.room.encrypted to the new API. 2019-07-19 14:52:30 -07:00
Jimmy Cuadra
0f49c5e7f6 Convert m.room.create to the new API. 2019-07-19 14:52:05 -07:00
Jimmy Cuadra
5b505cc501 Convert m.room.canonical_alias to the new API. Reorder additional fields
alphabetically. Remove unused serde attributes.
2019-07-19 14:49:05 -07:00
Jimmy Cuadra
71646445d5 Sort fields of ServerAclEvent alphabetically. 2019-07-19 14:48:38 -07:00
Jimmy Cuadra
406a007678 Add more tests. 2019-07-19 14:47:59 -07:00
Jimmy Cuadra
cc107106f0 Continue implementation of m.room.power_levels and add tests. 2019-07-19 14:47:01 -07:00
Jimmy Cuadra
090a91f78b Add new macros for implementing event traits. Fix Serialize impl for
NameEventContent. Convert m.room.power_levels to the new API.
2019-07-19 14:44:16 -07:00
Jimmy Cuadra
03099b9a8b Add InvalidInput type and convert m.room.name to the new API. 2019-07-19 14:43:24 -07:00
Jimmy Cuadra
afe44b4dda Convert m.room.server_acl to the new API. 2019-07-19 14:42:57 -07:00
Jimmy Cuadra
eaddc6dce2 Use str::parse for conversion from JSON. 2019-07-19 14:42:57 -07:00
Jimmy Cuadra
4212c9f619 Convert m.room.{aliases ,avatar ,encryption ,guest_access,
history_visibility, join_rules, member, pinned_events,
third_party_invite, tombstone, topic} to the new API.
2019-07-19 14:40:48 -07:00
Jimmy Cuadra
22c15277a7 Convert m.call.*, m.room.message.feedback, and m.room.redaction to the new
API.
2019-07-19 14:39:31 -07:00
Jimmy Cuadra
20d2482108 Convert m.key.verification.{accept,cancel,key,mac,request} and
m.room_key to the new API.
2019-07-19 14:37:21 -07:00
Jimmy Cuadra
3c70dac634 Convert m.fully_read to the new API. 2019-07-19 14:37:01 -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
c25d76e20f Treat deserialization failure as a validation failure.
If a ruma-events type fails deserialization, but the input was valid
JSON, this should be treated as a validation failure instead of a
deserialization failure. In this case, attempt to deserialize the json
into a `serde_json::Value`, and only return a deserialization error if
that fails.
2019-07-08 03:34:42 -07:00
Jimmy Cuadra
733dfa7ef3 Implement FromStr and TryFrom<&str> for content types. 2019-06-28 12:47:41 -07:00
Jimmy Cuadra
065cb770af Remove unnecessary for loops. 2019-06-22 00:21:23 -07:00
Jimmy Cuadra
a65a618930 Run rustfmt. 2019-06-21 17:18:06 -07:00
Jimmy Cuadra
db70792f03 Alphabetize struct fields. 2019-06-21 17:14:08 -07:00
Jimmy Cuadra
3bad559980 Add serialization and deserialization tests. 2019-06-21 17:00:28 -07:00
Jimmy Cuadra
e34ea05445 Skip serializing options. 2019-06-21 16:33:53 -07:00
Jimmy Cuadra
d9039db8df Convert from JSON using impl FromStr and impl TryFrom<&'a str> rather than an inherent from_str method. 2019-06-20 22:40:14 -07:00
Jimmy Cuadra
e13acb4d7d Fix copy/paste error. 2019-06-20 17:08:38 -07:00
Jimmy Cuadra
553d9c05cd Add support for events with custom types. 2019-06-20 17:05:30 -07:00
Jimmy Cuadra
44a13e6515 Add span information to token streams when possible. 2019-06-19 23:50:06 -07:00
Jimmy Cuadra
52754f617c Import Event trait in Serialize impl so event_type can be called. 2019-06-19 23:36:16 -07:00
Jimmy Cuadra
f663c79250 Remove extra commas from generated code. 2019-06-19 23:36:01 -07:00
Jimmy Cuadra
ce2a3817cf Rename ParseError to FromStrError and add InvalidEvent. 2019-06-19 22:45:20 -07:00
Jimmy Cuadra
4423275ce2 Implement RoomEvent and StateEvent when applicable. 2019-06-19 22:40:58 -07:00
Jimmy Cuadra
be0f1d0363 Add inherent impl with from_str method. 2019-06-19 21:14:49 -07:00
Jimmy Cuadra
78e25552fb Implement Serialize and Event. 2019-06-19 16:52:54 -07:00
Jimmy Cuadra
3b65905784 Generate content types and raw module. 2019-06-19 16:08:43 -07:00
Jimmy Cuadra
a5834ea192 Combine and sort common and custom fields using a Vec<Field>. 2019-06-19 15:40:29 -07:00
Jimmy Cuadra
2f54ee3e32 Implement generation of structs. 2019-06-18 17:54:50 -07:00
Jimmy Cuadra
48d6ef7ead Split parsing and generation into separate modules. 2019-06-18 16:59:48 -07:00
Jimmy Cuadra
65bd8e86cc ruma-events-macros 2019-06-18 16:34:45 -07:00
Jimmy Cuadra
1b0be0d0e7 Add crates.io categories. [ci skip] 2019-06-16 16:45:02 -07:00
Jimmy Cuadra
c3f48c5be3 Use js_int types for numbers.
Closes #27.
2019-06-16 16:16:37 -07:00
Jimmy Cuadra
04cdc96b8b Add m.push_rules. 2019-06-15 03:26:50 -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
f4b7204f31 Derive PartialEq where possible. 2019-06-15 00:03:32 -07:00