Add serde attributes to Option and Vec, and missing #[derive]s
This commit is contained in:
		
							parent
							
								
									6da028c0fe
								
							
						
					
					
						commit
						3c324d526c
					
				@ -7,8 +7,10 @@ pub mod register {
 | 
			
		||||
    /// This API endpoint's body parameters.
 | 
			
		||||
    #[derive(Clone, Debug, Deserialize, Serialize)]
 | 
			
		||||
    pub struct BodyParams {
 | 
			
		||||
        #[serde(skip_serializing_if = "Option::is_none")]
 | 
			
		||||
        pub bind_email: Option<bool>,
 | 
			
		||||
        pub password: String,
 | 
			
		||||
        #[serde(skip_serializing_if = "Option::is_none")]
 | 
			
		||||
        pub username: Option<String>,
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -16,8 +18,9 @@ pub mod register {
 | 
			
		||||
    pub struct Endpoint;
 | 
			
		||||
 | 
			
		||||
    /// This API endpoint's query string parameters.
 | 
			
		||||
    #[derive(Clone, Debug)]
 | 
			
		||||
    #[derive(Clone, Debug, Deserialize, Serialize)]
 | 
			
		||||
    pub struct QueryParams {
 | 
			
		||||
        #[serde(skip_serializing_if = "Option::is_none")]
 | 
			
		||||
        pub kind: Option<RegistrationKind>,
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -67,6 +70,7 @@ pub mod request_password_change_token {
 | 
			
		||||
    pub struct BodyParams {
 | 
			
		||||
        pub client_secret: String,
 | 
			
		||||
        pub email: String,
 | 
			
		||||
        #[serde(skip_serializing_if = "Option::is_none")]
 | 
			
		||||
        pub id_server: Option<String>,
 | 
			
		||||
        pub send_attempt: u64,
 | 
			
		||||
    }
 | 
			
		||||
@ -163,6 +167,7 @@ pub mod request_register_token {
 | 
			
		||||
    pub struct BodyParams {
 | 
			
		||||
        pub client_secret: String,
 | 
			
		||||
        pub email: String,
 | 
			
		||||
        #[serde(skip_serializing_if = "Option::is_none")]
 | 
			
		||||
        pub id_server: Option<String>,
 | 
			
		||||
        pub send_attempt: u64,
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -101,6 +101,7 @@ pub mod get {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// These API endpoints' path parameters.
 | 
			
		||||
#[derive(Clone, Debug, Deserialize, Serialize)]
 | 
			
		||||
pub struct PathParams {
 | 
			
		||||
    pub room_alias: RoomAliasId,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -7,6 +7,7 @@ pub mod add_contact {
 | 
			
		||||
    /// This API endpoint's body parameters.
 | 
			
		||||
    #[derive(Clone, Debug, Deserialize, Serialize)]
 | 
			
		||||
    pub struct BodyParams {
 | 
			
		||||
        #[serde(skip_serializing_if = "Option::is_none")]
 | 
			
		||||
        pub bind: Option<bool>,
 | 
			
		||||
        pub three_pid_creds: ThreePidCredentials,
 | 
			
		||||
    }
 | 
			
		||||
@ -98,6 +99,7 @@ pub mod request_contact_verification_token {
 | 
			
		||||
    pub struct BodyParams {
 | 
			
		||||
        pub client_secret: String,
 | 
			
		||||
        pub email: String,
 | 
			
		||||
        #[serde(skip_serializing_if = "Option::is_none")]
 | 
			
		||||
        pub id_server: Option<String>,
 | 
			
		||||
        pub send_attempt: u64,
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -19,7 +19,7 @@ pub mod get_context {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// This API endpoint's query string parameters.
 | 
			
		||||
    #[derive(Clone, Debug)]
 | 
			
		||||
    #[derive(Clone, Debug, Deserialize, Serialize)]
 | 
			
		||||
    pub struct QueryParams {
 | 
			
		||||
        pub limit: u8,
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -10,12 +10,15 @@ pub mod public_rooms {
 | 
			
		||||
    #[derive(Clone, Debug, Deserialize, Serialize)]
 | 
			
		||||
    pub struct PublicRoomsChunk {
 | 
			
		||||
        pub world_readable: bool,
 | 
			
		||||
        #[serde(skip_serializing_if = "Option::is_none")]
 | 
			
		||||
        pub topic: Option<String>,
 | 
			
		||||
        pub num_joined_members: u64,
 | 
			
		||||
        #[serde(skip_serializing_if = "Option::is_none")]
 | 
			
		||||
        pub avatar_url: Option<String>,
 | 
			
		||||
        pub room_id: RoomId,
 | 
			
		||||
        pub guest_can_join: bool,
 | 
			
		||||
        pub aliases: Vec<RoomAliasId>,
 | 
			
		||||
        #[serde(skip_serializing_if = "Option::is_none")]
 | 
			
		||||
        pub name: Option<String>
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -196,8 +196,10 @@ pub mod get_messages {
 | 
			
		||||
    #[derive(Clone, Debug, Deserialize, Serialize)]
 | 
			
		||||
    pub struct QueryParams {
 | 
			
		||||
        pub from: String,
 | 
			
		||||
        #[serde(skip_serializing_if = "Option::is_none")]
 | 
			
		||||
        pub to: Option<String>,
 | 
			
		||||
        pub dir: Direction,
 | 
			
		||||
        #[serde(skip_serializing_if = "Option::is_none")]
 | 
			
		||||
        pub limit: Option<u64>
 | 
			
		||||
    }
 | 
			
		||||
    
 | 
			
		||||
 | 
			
		||||
@ -16,44 +16,81 @@ pub enum EventFormat {
 | 
			
		||||
/// Filters to be applied to room events
 | 
			
		||||
#[derive(Clone, Debug, Deserialize, Serialize)]
 | 
			
		||||
pub struct RoomEventFilter {
 | 
			
		||||
    pub not_types: Option<Vec<String>>,
 | 
			
		||||
    pub not_rooms: Option<Vec<String>>,
 | 
			
		||||
    #[serde(skip_serializing_if = "Vec::is_empty")]
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    pub not_types: Vec<String>,
 | 
			
		||||
    #[serde(skip_serializing_if = "Vec::is_empty")]
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    pub not_rooms: Vec<String>,
 | 
			
		||||
    #[serde(skip_serializing_if = "Option::is_none")]
 | 
			
		||||
    pub limit: Option<u64>,
 | 
			
		||||
    pub rooms: Option<Vec<RoomId>>,
 | 
			
		||||
    pub not_senders: Option<Vec<UserId>>,
 | 
			
		||||
    pub senders: Option<Vec<UserId>>,
 | 
			
		||||
    pub types: Option<Vec<String>>
 | 
			
		||||
    #[serde(skip_serializing_if = "Vec::is_empty")]
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    pub rooms: Vec<RoomId>,
 | 
			
		||||
    #[serde(skip_serializing_if = "Vec::is_empty")]
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    pub not_senders: Vec<UserId>,
 | 
			
		||||
    #[serde(skip_serializing_if = "Vec::is_empty")]
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    pub senders: Vec<UserId>,
 | 
			
		||||
    #[serde(skip_serializing_if = "Vec::is_empty")]
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    pub types: Vec<String>
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// Filters to be applied to room data
 | 
			
		||||
#[derive(Clone, Debug, Deserialize, Serialize)]
 | 
			
		||||
pub struct RoomFilter {
 | 
			
		||||
    #[serde(skip_serializing_if = "Option::is_none")]
 | 
			
		||||
    pub include_leave: Option<bool>,
 | 
			
		||||
    #[serde(skip_serializing_if = "Option::is_none")]
 | 
			
		||||
    pub account_data: Option<RoomEventFilter>,
 | 
			
		||||
    #[serde(skip_serializing_if = "Option::is_none")]
 | 
			
		||||
    pub timeline: Option<RoomEventFilter>,
 | 
			
		||||
    #[serde(skip_serializing_if = "Option::is_none")]
 | 
			
		||||
    pub ephemeral: Option<RoomEventFilter>,
 | 
			
		||||
    #[serde(skip_serializing_if = "Option::is_none")]
 | 
			
		||||
    pub state: Option<RoomEventFilter>,
 | 
			
		||||
    pub not_rooms: Option<Vec<RoomId>>,
 | 
			
		||||
    pub room: Option<Vec<RoomId>>
 | 
			
		||||
    #[serde(skip_serializing_if = "Vec::is_empty")]
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    pub not_rooms: Vec<RoomId>,
 | 
			
		||||
    #[serde(skip_serializing_if = "Vec::is_empty")]
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    pub room: Vec<RoomId>
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// Filter for not-room data
 | 
			
		||||
#[derive(Clone, Debug, Deserialize, Serialize)]
 | 
			
		||||
pub struct Filter {
 | 
			
		||||
    pub not_types: Option<Vec<String>>,
 | 
			
		||||
    #[serde(skip_serializing_if = "Vec::is_empty")]
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    pub not_types: Vec<String>,
 | 
			
		||||
    #[serde(skip_serializing_if = "Option::is_none")]
 | 
			
		||||
    pub limit: Option<u64>,
 | 
			
		||||
    pub senders: Option<Vec<UserId>>,
 | 
			
		||||
    pub types: Option<Vec<String>>,
 | 
			
		||||
    pub not_senders: Option<Vec<UserId>>
 | 
			
		||||
    #[serde(skip_serializing_if = "Vec::is_empty")]
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    pub senders: Vec<UserId>,
 | 
			
		||||
    #[serde(skip_serializing_if = "Vec::is_empty")]
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    pub types: Vec<String>,
 | 
			
		||||
    #[serde(skip_serializing_if = "Vec::is_empty")]
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    pub not_senders: Vec<UserId>
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/// A filter definition
 | 
			
		||||
#[derive(Clone, Debug, Deserialize, Serialize)]
 | 
			
		||||
pub struct FilterDefinition {
 | 
			
		||||
    pub event_fields: Option<Vec<String>>,
 | 
			
		||||
    #[serde(skip_serializing_if = "Vec::is_empty")]
 | 
			
		||||
    #[serde(default)]
 | 
			
		||||
    pub event_fields: Vec<String>,
 | 
			
		||||
    #[serde(skip_serializing_if = "Option::is_none")]
 | 
			
		||||
    pub event_format: Option<EventFormat>,
 | 
			
		||||
    #[serde(skip_serializing_if = "Option::is_none")]
 | 
			
		||||
    pub account_data: Option<Filter>,
 | 
			
		||||
    #[serde(skip_serializing_if = "Option::is_none")]
 | 
			
		||||
    pub room: Option<RoomFilter>,
 | 
			
		||||
    #[serde(skip_serializing_if = "Option::is_none")]
 | 
			
		||||
    pub presence: Option<Filter>
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -69,6 +69,7 @@ pub mod join_by_room_id_or_alias {
 | 
			
		||||
    /// The request type.
 | 
			
		||||
    #[derive(Clone, Debug, Deserialize, Serialize)]
 | 
			
		||||
    pub struct BodyParams {
 | 
			
		||||
        #[serde(skip_serializing_if = "Option::is_none")]
 | 
			
		||||
        pub third_party_signed: Option<ThirdPartySigned>,
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -130,6 +131,7 @@ pub mod join_by_room_id {
 | 
			
		||||
    /// The request type.
 | 
			
		||||
    #[derive(Clone, Debug, Deserialize, Serialize)]
 | 
			
		||||
    pub struct BodyParams {
 | 
			
		||||
        #[serde(skip_serializing_if = "Option::is_none")]
 | 
			
		||||
        pub third_party_signed: Option<ThirdPartySigned>,
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -257,6 +259,7 @@ pub mod kick {
 | 
			
		||||
    #[derive(Clone, Debug, Deserialize, Serialize)]
 | 
			
		||||
    pub struct BodyParams {
 | 
			
		||||
        pub user_id: String,
 | 
			
		||||
        #[serde(skip_serializing_if = "Option::is_none")]
 | 
			
		||||
        pub reason: Option<String>,
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -345,6 +348,7 @@ pub mod ban {
 | 
			
		||||
    /// The request type.
 | 
			
		||||
    #[derive(Clone, Debug, Deserialize, Serialize)]
 | 
			
		||||
    pub struct BodyParams {
 | 
			
		||||
        #[serde(skip_serializing_if = "Option::is_none")]
 | 
			
		||||
        pub reason: Option<String>,
 | 
			
		||||
        pub user_id: String,
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -19,6 +19,7 @@ pub mod set_presence {
 | 
			
		||||
    /// This API endpoint's body parameters.
 | 
			
		||||
    #[derive(Clone, Debug, Deserialize, Serialize)]
 | 
			
		||||
    pub struct BodyParams {
 | 
			
		||||
        #[serde(skip_serializing_if = "Option::is_none")]
 | 
			
		||||
        status_msg: Option<String>,
 | 
			
		||||
        presence: PresenceState
 | 
			
		||||
    }
 | 
			
		||||
@ -65,8 +66,11 @@ pub mod get_presence {
 | 
			
		||||
    /// This API endpoint's response.
 | 
			
		||||
    #[derive(Clone, Debug, Deserialize, Serialize)]
 | 
			
		||||
    pub struct Response {
 | 
			
		||||
        #[serde(skip_serializing_if = "Option::is_none")]
 | 
			
		||||
        pub status_msg: Option<String>,
 | 
			
		||||
        #[serde(skip_serializing_if = "Option::is_none")]
 | 
			
		||||
        pub currently_active: Option<bool>,
 | 
			
		||||
        #[serde(skip_serializing_if = "Option::is_none")]
 | 
			
		||||
        pub last_active_ago: Option<u64>,
 | 
			
		||||
        pub presence: PresenceState
 | 
			
		||||
    }
 | 
			
		||||
@ -112,8 +116,12 @@ pub mod update_presence_list {
 | 
			
		||||
    /// This API endpoint's body parameters.
 | 
			
		||||
    #[derive(Clone, Debug, Deserialize, Serialize)]
 | 
			
		||||
    pub struct BodyParams {
 | 
			
		||||
        drop: Option<Vec<UserId>>,
 | 
			
		||||
        invite: Option<Vec<UserId>>
 | 
			
		||||
        #[serde(skip_serializing_if = "Vec::is_empty")]
 | 
			
		||||
        #[serde(default)]
 | 
			
		||||
        drop: Vec<UserId>,
 | 
			
		||||
        #[serde(skip_serializing_if = "Vec::is_empty")]
 | 
			
		||||
        #[serde(default)]
 | 
			
		||||
        invite: Vec<UserId>
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    impl ::Endpoint for Endpoint {
 | 
			
		||||
 | 
			
		||||
@ -15,6 +15,7 @@ pub mod get_display_name {
 | 
			
		||||
    /// This API endpoint's body parameters.
 | 
			
		||||
    #[derive(Clone, Debug, Deserialize, Serialize)]
 | 
			
		||||
    pub struct Response {
 | 
			
		||||
        #[serde(skip_serializing_if = "Option::is_none")]
 | 
			
		||||
        pub displayname: Option<String>
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -60,6 +61,7 @@ pub mod set_display_name {
 | 
			
		||||
    /// This API endpoint's body parameters.
 | 
			
		||||
    #[derive(Clone, Debug, Deserialize, Serialize)]
 | 
			
		||||
    pub struct BodyParams {
 | 
			
		||||
        #[serde(skip_serializing_if = "Option::is_none")]
 | 
			
		||||
        pub displayname: Option<String>
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -104,6 +106,7 @@ pub mod get_avatar_url {
 | 
			
		||||
    /// This API endpoint's body parameters.
 | 
			
		||||
    #[derive(Clone, Debug, Deserialize, Serialize)]
 | 
			
		||||
    pub struct Response {
 | 
			
		||||
        #[serde(skip_serializing_if = "Option::is_none")]
 | 
			
		||||
        pub avatar_url: Option<String>
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -148,6 +151,7 @@ pub mod set_avatar_url {
 | 
			
		||||
    /// This API endpoint's body parameters.
 | 
			
		||||
    #[derive(Clone, Debug, Deserialize, Serialize)]
 | 
			
		||||
    pub struct BodyParams {
 | 
			
		||||
        #[serde(skip_serializing_if = "Option::is_none")]
 | 
			
		||||
        pub avatar_url: Option<String>
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -192,7 +196,9 @@ pub mod get_profile {
 | 
			
		||||
    /// This API endpoint's body parameters.
 | 
			
		||||
    #[derive(Clone, Debug, Deserialize, Serialize)]
 | 
			
		||||
    pub struct Response {
 | 
			
		||||
        #[serde(skip_serializing_if = "Option::is_none")]
 | 
			
		||||
        pub avatar_url: Option<String>,
 | 
			
		||||
        #[serde(skip_serializing_if = "Option::is_none")]
 | 
			
		||||
        pub displayname: Option<String>
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -20,6 +20,7 @@ pub mod send_event {
 | 
			
		||||
    /// This API endpoint's path parameters.
 | 
			
		||||
    #[derive(Clone, Debug, Deserialize, Serialize)]
 | 
			
		||||
    pub struct BodyParams {
 | 
			
		||||
        #[serde(skip_serializing_if = "Option::is_none")]
 | 
			
		||||
        pub reason: Option<String>
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -9,12 +9,20 @@ pub mod create_room {
 | 
			
		||||
    /// The request type.
 | 
			
		||||
    #[derive(Clone, Debug, Deserialize, Serialize)]
 | 
			
		||||
    pub struct BodyParams {
 | 
			
		||||
        #[serde(skip_serializing_if = "Option::is_none")]
 | 
			
		||||
        pub creation_content: Option<CreationContent>,
 | 
			
		||||
        pub invite: Option<Vec<String>>,
 | 
			
		||||
        #[serde(skip_serializing_if = "Vec::is_empty")]
 | 
			
		||||
        #[serde(default)]
 | 
			
		||||
        pub invite: Vec<String>,
 | 
			
		||||
        #[serde(skip_serializing_if = "Option::is_none")]
 | 
			
		||||
        pub name: Option<String>,
 | 
			
		||||
        #[serde(skip_serializing_if = "Option::is_none")]
 | 
			
		||||
        pub preset: Option<RoomPreset>,
 | 
			
		||||
        #[serde(skip_serializing_if = "Option::is_none")]
 | 
			
		||||
        pub room_alias_name: Option<String>,
 | 
			
		||||
        #[serde(skip_serializing_if = "Option::is_none")]
 | 
			
		||||
        pub topic: Option<String>,
 | 
			
		||||
        #[serde(skip_serializing_if = "Option::is_none")]
 | 
			
		||||
        pub visibility: Option<String>,
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@ -22,6 +30,7 @@ pub mod create_room {
 | 
			
		||||
    #[derive(Clone, Debug, Deserialize, Serialize)]
 | 
			
		||||
    pub struct CreationContent {
 | 
			
		||||
        #[serde(rename="m.federate")]
 | 
			
		||||
        #[serde(skip_serializing_if = "Option::is_none")]
 | 
			
		||||
        pub federate: Option<bool>,
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -12,6 +12,7 @@ pub mod login {
 | 
			
		||||
    pub struct Response {
 | 
			
		||||
        pub access_token: String,
 | 
			
		||||
        pub home_server: String,
 | 
			
		||||
        #[serde(skip_serializing_if = "Option::is_none")]
 | 
			
		||||
        pub refresh_token: Option<String>,
 | 
			
		||||
        pub user_id: String,
 | 
			
		||||
    }
 | 
			
		||||
@ -80,6 +81,7 @@ pub mod refresh_access_token {
 | 
			
		||||
    #[derive(Clone, Debug, Deserialize, Serialize)]
 | 
			
		||||
    pub struct Response {
 | 
			
		||||
        pub access_token: String,
 | 
			
		||||
        #[serde(skip_serializing_if = "Option::is_none")]
 | 
			
		||||
        pub refresh_token: Option<String>,
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -21,10 +21,15 @@ pub mod sync {
 | 
			
		||||
    /// This API endpoint's query parameters.
 | 
			
		||||
    #[derive(Clone, Debug, Deserialize, Serialize)]
 | 
			
		||||
    pub struct QueryParams {
 | 
			
		||||
        #[serde(skip_serializing_if = "Option::is_none")]
 | 
			
		||||
        pub filter: Option<String>,
 | 
			
		||||
        #[serde(skip_serializing_if = "Option::is_none")]
 | 
			
		||||
        pub since: Option<String>,
 | 
			
		||||
        #[serde(skip_serializing_if = "Option::is_none")]
 | 
			
		||||
        pub full_state: Option<bool>,
 | 
			
		||||
        #[serde(skip_serializing_if = "Option::is_none")]
 | 
			
		||||
        pub set_presence: Option<SetPresence>,
 | 
			
		||||
        #[serde(skip_serializing_if = "Option::is_none")]
 | 
			
		||||
        pub timeout: Option<u64>
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -20,6 +20,7 @@ pub mod set_typing {
 | 
			
		||||
    #[derive(Clone, Debug, Deserialize, Serialize)]
 | 
			
		||||
    pub struct BodyParams {
 | 
			
		||||
        pub typing: bool,
 | 
			
		||||
        #[serde(skip_serializing_if = "Option::is_none")]
 | 
			
		||||
        pub timeout: Option<u64>
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user