diff --git a/Cargo.toml b/Cargo.toml index 285fd0d6..9c27751c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,15 +11,15 @@ repository = "https://github.com/ruma/ruma-client-api" version = "0.1.0" [dependencies] -futures = "0.1.14" -hyper = "0.11.1" -ruma-api = "0.4.0" -ruma-api-macros = "0.1.0" -ruma-events = "0.9.0" +futures = "0.1.21" +http = "0.1.5" +ruma-api = "0.5.0" +ruma-api-macros = "0.2.2" +ruma-events = "0.10.0" ruma-identifiers = "0.11.0" ruma-signatures = "0.4.0" -serde = "1.0.9" -serde_derive = "1.0.9" -serde_json = "1.0.2" -serde_urlencoded = "0.5.1" -url = "1.5.1" +serde = "1.0.57" +serde_derive = "1.0.57" +serde_json = "1.0.17" +serde_urlencoded = "0.5.2" +url = "1.7.0" diff --git a/src/lib.rs b/src/lib.rs index c69887fa..0edbb06c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -6,7 +6,7 @@ #![feature(proc_macro, try_from)] extern crate futures; -extern crate hyper; +extern crate http; extern crate ruma_api; extern crate ruma_api_macros; extern crate ruma_events; diff --git a/src/r0/account.rs b/src/r0/account.rs index 7daac47b..d60fbe12 100644 --- a/src/r0/account.rs +++ b/src/r0/account.rs @@ -8,7 +8,7 @@ pub mod register { ruma_api! { metadata { description: "Register an account on this homeserver.", - method: Method::Post, + method: POST, name: "register", path: "/_matrix/client/r0/register", rate_limited: true, @@ -105,7 +105,7 @@ pub mod request_password_change_token { ruma_api! { metadata { description: "Request that a password change token is sent to the given email address.", - method: Method::Post, + method: POST, name: "request_password_change_token", path: "/_matrix/client/r0/account/password/email/requestToken", rate_limited: false, @@ -137,7 +137,7 @@ pub mod deactivate { ruma_api! { metadata { description: "Deactivate the current user's account.", - method: Method::Post, + method: POST, name: "deactivate", path: "/_matrix/client/r0/account/deactivate", rate_limited: true, @@ -157,7 +157,7 @@ pub mod change_password { ruma_api! { metadata { description: "Change the password of the current user's account.", - method: Method::Post, + method: POST, name: "change_password", path: "/_matrix/client/r0/account/password", rate_limited: true, @@ -181,7 +181,7 @@ pub mod request_register_token { ruma_api! { metadata { description: "Request a register token with a 3rd party email.", - method: Method::Post, + method: POST, name: "request_register_token", path: "/_matrix/client/r0/register/email/requestToken", rate_limited: true, diff --git a/src/r0/alias.rs b/src/r0/alias.rs index 66d86f59..c102f867 100644 --- a/src/r0/alias.rs +++ b/src/r0/alias.rs @@ -8,7 +8,7 @@ pub mod create_alias { ruma_api! { metadata { description: "Add an alias to a room.", - method: Method::Put, + method: PUT, name: "create_alias", path: "/_matrix/client/r0/directory/room/:room_alias", rate_limited: false, @@ -35,7 +35,7 @@ pub mod delete_alias { ruma_api! { metadata { description: "Remove an alias from a room.", - method: Method::Delete, + method: DELETE, name: "delete_alias", path: "/_matrix/client/r0/directory/room/:room_alias", rate_limited: false, @@ -60,7 +60,7 @@ pub mod get_alias { ruma_api! { metadata { description: "Resolve a room alias to a room ID.", - method: Method::Get, + method: GET, name: "get_alias", path: "/_matrix/client/r0/directory/room/:room_alias", rate_limited: false, diff --git a/src/r0/config.rs b/src/r0/config.rs index 31b5e844..51336a2f 100644 --- a/src/r0/config.rs +++ b/src/r0/config.rs @@ -9,7 +9,7 @@ pub mod set_room_account_data { ruma_api! { metadata { description: "Associate account data with a room.", - method: Method::Put, + method: PUT, name: "set_room_account_data", path: "/_matrix/client/r0/user/:user_id/rooms/:room_id/account_data/:event_type", rate_limited: false, @@ -48,7 +48,7 @@ pub mod set_global_account_data { ruma_api! { metadata { description: "Sets global account data.", - method: Method::Put, + method: PUT, name: "set_global_account_data", path: "/_matrix/client/r0/user/:user_id/account_data/:event_type", rate_limited: false, diff --git a/src/r0/contact.rs b/src/r0/contact.rs index 4a9bdcc0..896e0a26 100644 --- a/src/r0/contact.rs +++ b/src/r0/contact.rs @@ -7,7 +7,7 @@ pub mod create_contact { ruma_api! { metadata { description: "Adds contact information to the user's account.", - method: Method::Post, + method: POST, name: "create_contact", path: "/_matrix/client/r0/account/3pid", rate_limited: false, @@ -47,7 +47,7 @@ pub mod get_contacts { ruma_api! { metadata { description: "Get a list of 3rd party contacts associated with the user's account.", - method: Method::Get, + method: GET, name: "get_contacts", path: "/_matrix/client/r0/account/3pid", rate_limited: false, @@ -88,7 +88,7 @@ pub mod request_contact_verification_token { ruma_api! { metadata { description: "Ask for a verification token for a given 3rd party ID.", - method: Method::Post, + method: POST, name: "request_contact_verification_token", path: "/_matrix/client/r0/account/3pid/email/requestToken", rate_limited: false, diff --git a/src/r0/context.rs b/src/r0/context.rs index d37e2349..07fb825f 100644 --- a/src/r0/context.rs +++ b/src/r0/context.rs @@ -9,7 +9,7 @@ pub mod get_context { ruma_api! { metadata { description: "Get the events immediately preceding and following a given event.", - method: Method::Get, + method: GET, path: "/_matrix/client/r0/rooms/:room_id/context/:event_id", name: "get_context", rate_limited: false, diff --git a/src/r0/directory.rs b/src/r0/directory.rs index fc1c4c17..6b513fef 100644 --- a/src/r0/directory.rs +++ b/src/r0/directory.rs @@ -8,7 +8,7 @@ pub mod get_public_rooms { ruma_api! { metadata { description: "Get the list of rooms in this homeserver's public directory.", - method: Method::Get, + method: GET, name: "get_public_rooms", path: "/_matrix/client/r0/publicRooms", rate_limited: false, diff --git a/src/r0/filter.rs b/src/r0/filter.rs index 7e658f47..4ee85985 100644 --- a/src/r0/filter.rs +++ b/src/r0/filter.rs @@ -175,7 +175,7 @@ pub mod create_filter { ruma_api! { metadata { description: "Create a new filter for event retrieval.", - method: Method::Post, + method: POST, name: "create_filter", path: "/_matrix/client/r0/user/:user_id/filter", rate_limited: false, @@ -210,7 +210,7 @@ pub mod get_filter { ruma_api! { metadata { description: "Retrieve a previously created filter.", - method: Method::Get, + method: GET, name: "get_filter", path: "/_matrix/client/r0/user/:user_id/filter/:filter_id", rate_limited: false, diff --git a/src/r0/media.rs b/src/r0/media.rs index 668aabc7..0b51c95d 100644 --- a/src/r0/media.rs +++ b/src/r0/media.rs @@ -2,13 +2,12 @@ /// [GET /_matrix/media/r0/download/{serverName}/{mediaId}](https://matrix.org/docs/spec/client_server/r0.2.0.html#get-matrix-media-r0-download-servername-mediaid) pub mod get_content { - use hyper::header::{ContentDisposition, ContentType}; use ruma_api_macros::ruma_api; ruma_api! { metadata { description: "Retrieve content from the media store.", - method: Method::Get, + method: GET, name: "get_media_content", path: "/_matrix/media/r0/download/:server_name/:media_id", rate_limited: false, @@ -29,24 +28,23 @@ pub mod get_content { #[ruma_api(body)] pub file: Vec, /// The content type of the file that was previously uploaded. - #[ruma_api(header)] - pub content_type: ContentType, + #[ruma_api(header = "CONTENT_TYPE")] + pub content_type: String, /// The name of the file that was previously uploaded, if set. - #[ruma_api(header)] - pub content_disposition: ContentDisposition, + #[ruma_api(header = "CONTENT_DISPOSITION")] + pub content_disposition: String, } } } /// [POST /_matrix/media/r0/upload](https://matrix.org/docs/spec/client_server/r0.2.0.html#post-matrix-media-r0-upload) pub mod create_content { - use hyper::header::ContentType; use ruma_api_macros::ruma_api; ruma_api! { metadata { description: "Upload content to the media store.", - method: Method::Post, + method: POST, name: "create_media_content", path: "/_matrix/media/r0/upload", rate_limited: false, @@ -55,8 +53,8 @@ pub mod create_content { request { /// The content type of the file being uploaded. - #[ruma_api(header)] - pub content_type: ContentType, + #[ruma_api(header = "CONTENT_TYPE")] + pub content_type: String, } response { @@ -84,7 +82,7 @@ pub mod get_content_thumbnail { ruma_api! { metadata { description: "Get a thumbnail of content from the media store.", - method: Method::Get, + method: GET, name: "get_content_thumbnail", path: "/_matrix/media/r0/thumbnail/:server_name/:media_id", rate_limited: false, diff --git a/src/r0/membership.rs b/src/r0/membership.rs index ed0b1552..ae002046 100644 --- a/src/r0/membership.rs +++ b/src/r0/membership.rs @@ -27,7 +27,7 @@ pub mod invite_user { ruma_api! { metadata { description: "Invite a user to a room.", - method: Method::Post, + method: POST, name: "invite_user", path: "/_matrix/client/r0/rooms/:room_id/invite", rate_limited: true, @@ -56,7 +56,7 @@ pub mod join_room_by_id_or_alias { ruma_api! { metadata { description: "Join a room using its ID or one of its aliases.", - method: Method::Post, + method: POST, name: "join_room_by_id_or_alias", path: "/_matrix/client/r0/join/:room_id_or_alias", rate_limited: true, @@ -90,7 +90,7 @@ pub mod join_room_by_id { ruma_api! { metadata { description: "Join a room using its ID.", - method: Method::Post, + method: POST, name: "join_room_by_id", path: "/_matrix/client/r0/rooms/:room_id/join", rate_limited: true, @@ -122,7 +122,7 @@ pub mod forget_room { ruma_api! { metadata { description: "Forget a room.", - method: Method::Post, + method: POST, name: "forget_room", path: "/_matrix/client/r0/rooms/:room_id/forget", rate_limited: true, @@ -147,7 +147,7 @@ pub mod leave_room { ruma_api! { metadata { description: "Leave a room.", - method: Method::Post, + method: POST, name: "leave_room", path: "/_matrix/client/r0/rooms/:room_id/leave", rate_limited: true, @@ -172,7 +172,7 @@ pub mod kick_user { ruma_api! { metadata { description: "Kick a user from a room.", - method: Method::Post, + method: POST, name: "kick_user", path: "/_matrix/client/r0/rooms/:room_id/kick", rate_limited: false, @@ -202,7 +202,7 @@ pub mod unban_user { ruma_api! { metadata { description: "Unban a user from a room.", - method: Method::Post, + method: POST, name: "unban_user", path: "/_matrix/client/r0/rooms/:room_id/unban", rate_limited: false, @@ -229,7 +229,7 @@ pub mod ban_user { ruma_api! { metadata { description: "Ban a user from a room.", - method: Method::Post, + method: POST, name: "ban_user", path: "/_matrix/client/r0/rooms/:room_id/ban", rate_limited: false, diff --git a/src/r0/presence.rs b/src/r0/presence.rs index 5b29b7e1..7d961e5e 100644 --- a/src/r0/presence.rs +++ b/src/r0/presence.rs @@ -9,7 +9,7 @@ pub mod set_presence { ruma_api! { metadata { description: "Set presence status for this user.", - method: Method::Put, + method: PUT, name: "set_presence", path: "/_matrix/client/r0/presence/:user_id/status", rate_limited: true, @@ -40,7 +40,7 @@ pub mod get_presence { ruma_api! { metadata { description: "Get presence status for this user.", - method: Method::Get, + method: GET, name: "get_presence", path: "/_matrix/client/r0/presence/:user_id/status", rate_limited: false, @@ -77,7 +77,7 @@ pub mod update_presence_subscriptions { ruma_api! { metadata { description: "Update the presence subscriptions of the user.", - method: Method::Post, + method: POST, name: "update_presence_subscriptions", path: "/_matrix/client/r0/presence/list/:user_id", rate_limited: true, @@ -111,7 +111,7 @@ pub mod get_subscribed_presences { ruma_api! { metadata { description: "Get the precence status from the user's subscriptions.", - method: Method::Get, + method: GET, name: "get_subscribed_presences", path: "/_matrix/client/r0/presence/list/:user_id", rate_limited: false, diff --git a/src/r0/profile.rs b/src/r0/profile.rs index 29769472..83440464 100644 --- a/src/r0/profile.rs +++ b/src/r0/profile.rs @@ -8,7 +8,7 @@ pub mod get_display_name { ruma_api! { metadata { description: "Get the display name of a user.", - method: Method::Get, + method: GET, name: "get_display_name", path: "/_matrix/client/r0/profile/:user_id/displayname", rate_limited: false, @@ -37,7 +37,7 @@ pub mod set_display_name { ruma_api! { metadata { description: "Set the display name of the user.", - method: Method::Put, + method: PUT, name: "set_display_name", path: "/_matrix/client/r0/profile/:user_id/displayname", rate_limited: true, @@ -65,7 +65,7 @@ pub mod get_avatar_url { ruma_api! { metadata { description: "Get the avatar URL of a user.", - method: Method::Get, + method: GET, name: "get_avatar_url", path: "/_matrix/client/r0/profile/:user_id/avatar_url", rate_limited: false, @@ -94,7 +94,7 @@ pub mod set_avatar_url { ruma_api! { metadata { description: "Set the avatar URL of the user.", - method: Method::Put, + method: PUT, name: "set_avatar_url", path: "/_matrix/client/r0/profile/:user_id/avatar_url", rate_limited: true, @@ -121,7 +121,7 @@ pub mod get_profile { ruma_api! { metadata { description: "Get all profile information of an user.", - method: Method::Get, + method: GET, name: "get_profile", path: "/_matrix/client/r0/profile/:user_id", rate_limited: false, diff --git a/src/r0/receipt.rs b/src/r0/receipt.rs index 51ec07d9..fcabd686 100644 --- a/src/r0/receipt.rs +++ b/src/r0/receipt.rs @@ -10,7 +10,7 @@ pub mod create_receipt { ruma_api! { metadata { description: "Send a receipt event to a room.", - method: Method::Post, + method: POST, name: "create_receipt", path: "/_matrix/client/r0/rooms/:room_id/receipt/:receipt_type/:event_id", rate_limited: true, diff --git a/src/r0/redact.rs b/src/r0/redact.rs index ead9fbee..5d83a5a6 100644 --- a/src/r0/redact.rs +++ b/src/r0/redact.rs @@ -8,7 +8,7 @@ pub mod redact_event { ruma_api! { metadata { description: "Redact an event, stripping all information not critical to the event graph integrity.", - method: Method::Put, + method: PUT, name: "redact_event", path: "/_matrix/client/r0/rooms/:room_id/redact/:event_id/:txn_id", rate_limited: false, diff --git a/src/r0/room.rs b/src/r0/room.rs index a7da4473..1435497e 100644 --- a/src/r0/room.rs +++ b/src/r0/room.rs @@ -8,7 +8,7 @@ pub mod create_room { ruma_api! { metadata { description: "Create a new room.", - method: Method::Post, + method: POST, name: "create_room", path: "/_matrix/client/r0/createRoom", rate_limited: false, diff --git a/src/r0/search.rs b/src/r0/search.rs index 9da4b959..ff6f2cb6 100644 --- a/src/r0/search.rs +++ b/src/r0/search.rs @@ -13,7 +13,7 @@ pub mod search_events { ruma_api! { metadata { description: "Search events.", - method: Method::Post, + method: POST, name: "search", path: "/_matrix/client/r0/search", rate_limited: true, diff --git a/src/r0/send.rs b/src/r0/send.rs index ddf26bcc..21cd1e55 100644 --- a/src/r0/send.rs +++ b/src/r0/send.rs @@ -10,7 +10,7 @@ pub mod send_state_event_for_empty_key { ruma_api! { metadata { description: "Send a state event to a room associated with the empty state key.", - method: Method::Put, + method: PUT, name: "send_state_event_for_empty_key", path: "/_matrix/client/r0/rooms/:room_id/state/:event_type", rate_limited: false, @@ -46,7 +46,7 @@ pub mod send_state_event_for_key { ruma_api! { metadata { description: "Send a state event to a room associated with a given state key.", - method: Method::Put, + method: PUT, name: "send_state_event_for_key", path: "/_matrix/client/r0/rooms/:room_id/state/:event_type/:state_key", rate_limited: false, @@ -85,7 +85,7 @@ pub mod send_message_event { ruma_api! { metadata { description: "Send a message event to a room.", - method: Method::Put, + method: PUT, name: "send_message_event", path: "/_matrix/client/r0/rooms/:room_id/send/:event_type/:txn_id", rate_limited: false, diff --git a/src/r0/server.rs b/src/r0/server.rs index 0bf2fd95..844b3263 100644 --- a/src/r0/server.rs +++ b/src/r0/server.rs @@ -10,7 +10,7 @@ pub mod get_user_info { ruma_api! { metadata { description: "Get information about a particular user.", - method: Method::Get, + method: GET, name: "get_user_info", path: "/_matrix/client/r0/admin/whois/:user_id", rate_limited: false, diff --git a/src/r0/session.rs b/src/r0/session.rs index 386878d3..e96fd77a 100644 --- a/src/r0/session.rs +++ b/src/r0/session.rs @@ -8,7 +8,7 @@ pub mod login { ruma_api! { metadata { description: "Login to the homeserver.", - method: Method::Post, + method: POST, name: "login", path: "/_matrix/client/r0/login", rate_limited: true, @@ -77,7 +77,7 @@ pub mod logout { ruma_api! { metadata { description: "Log out of the homeserver.", - method: Method::Post, + method: POST, name: "logout", path: "/_matrix/client/r0/logout", rate_limited: false, diff --git a/src/r0/sync.rs b/src/r0/sync.rs index b387b41a..975141ba 100644 --- a/src/r0/sync.rs +++ b/src/r0/sync.rs @@ -9,7 +9,7 @@ pub mod get_state_events { ruma_api! { metadata { description: "Get state events for a room.", - method: Method::Get, + method: GET, name: "get_state_events", path: "/_matrix/client/r0/rooms/:room_id/state", rate_limited: false, @@ -41,7 +41,7 @@ pub mod get_state_events_for_empty_key { ruma_api! { metadata { description: "Get state events of a given type associated with the empty key.", - method: Method::Get, + method: GET, name: "get_state_events_for_empty_key", path: "/_matrix/client/r0/rooms/:room_id/state/:event_type", rate_limited: false, @@ -73,7 +73,7 @@ pub mod get_state_events_for_key { ruma_api! { metadata { description: "Get state events associated with a given key.", - method: Method::Get, + method: GET, name: "get_state_events_for_key", path: "/_matrix/client/r0/rooms/:room_id/state/:event_type/:state_key", rate_limited: false, @@ -109,7 +109,7 @@ pub mod get_member_events { ruma_api! { metadata { description: "Get membership events for a room.", - method: Method::Get, + method: GET, name: "get_member_events", path: "/_matrix/client/r0/rooms/:room_id/members", rate_limited: false, @@ -138,7 +138,7 @@ pub mod get_message_events { ruma_api! { metadata { description: "Get message events for a room.", - method: Method::Get, + method: GET, name: "get_message_events", path: "/_matrix/client/r0/rooms/:room_id/messages", rate_limited: false, @@ -206,7 +206,7 @@ pub mod sync_events { ruma_api! { metadata { description: "Get all new events from all rooms since the last sync or a given point of time.", - method: Method::Get, + method: GET, name: "sync", path: "/_matrix/client/r0/sync", rate_limited: false, diff --git a/src/r0/tag.rs b/src/r0/tag.rs index 9f8b0370..f6e5e333 100644 --- a/src/r0/tag.rs +++ b/src/r0/tag.rs @@ -9,7 +9,7 @@ pub mod create_tag { ruma_api! { metadata { description: "Add a new tag to a room.", - method: Method::Put, + method: PUT, name: "create_tag", path: "/_matrix/client/r0/user/:user_id/rooms/:room_id/tags/:tag", rate_limited: false, @@ -44,7 +44,7 @@ pub mod get_tags { ruma_api! { metadata { description: "Get the tags associated with a room.", - method: Method::Get, + method: GET, name: "get_tags", path: "/_matrix/client/r0/user/:user_id/rooms/:room_id/tags", rate_limited: false, @@ -75,7 +75,7 @@ pub mod delete_tag { ruma_api! { metadata { description: "Remove a tag from a room.", - method: Method::Delete, + method: DELETE, name: "delete_tag", path: "/_matrix/client/r0/user/:user_id/rooms/:room_id/tags/:tag", rate_limited: false, diff --git a/src/r0/typing.rs b/src/r0/typing.rs index b83a632d..eac4f8e8 100644 --- a/src/r0/typing.rs +++ b/src/r0/typing.rs @@ -7,7 +7,7 @@ pub mod create_typing_event { ruma_api! { metadata { - method: Method::Put, + method: PUT, path: "/_matrix/client/r0/rooms/:room_id/typing/:user_id", name: "create_typing_event", description: "Send a typing event to a room.", diff --git a/src/r0/voip.rs b/src/r0/voip.rs index 4baa289e..a83ed694 100644 --- a/src/r0/voip.rs +++ b/src/r0/voip.rs @@ -7,7 +7,7 @@ pub mod get_turn_server_info { ruma_api! { metadata { description: "Get credentials for the client to use when initiating VoIP calls.", - method: Method::Get, + method: GET, name: "turn_server_info", path: "_matrix/client/r0/voip/turnServer", rate_limited: true, diff --git a/src/unversioned.rs b/src/unversioned.rs index 0c1dc831..7c4be014 100644 --- a/src/unversioned.rs +++ b/src/unversioned.rs @@ -7,7 +7,7 @@ pub mod get_supported_versions { ruma_api! { metadata { description: "Get the versions of the client-server API supported by this homeserver.", - method: Method::Get, + method: GET, name: "api_versions", path: "/_matrix/client/versions", rate_limited: false,