diff --git a/Cargo.toml b/Cargo.toml index be841e9c..81e1485b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -51,11 +51,6 @@ features = [ "reqwest_blocking", ] -[[example]] -name = "start_rtm" -path = "examples/start_rtm.rs" -required-features = ["reqwest"] - [[example]] name = "channel_history" path = "examples/channel_history.rs" diff --git a/codegen/src/adapt.rs b/codegen/src/adapt.rs new file mode 100644 index 00000000..96d8cfc3 --- /dev/null +++ b/codegen/src/adapt.rs @@ -0,0 +1,130 @@ +#![allow(clippy::single_match)] + +use crate::rust::{Method, Module, ResponseType}; + +pub fn correct(modules: &mut [Module]) { + for module in modules { + match module.name.as_str() { + "conversations" => correct_conversations(module), + _ => {} + } + } +} + +fn correct_conversations(module: &mut Module) { + for mut method in &mut module.methods { + match method.name.as_str() { + "history" => correct_conversations_history(&mut method), + "info" => correct_conversations_info(&mut method), + "list" => correct_conversations_list(&mut method), + _ => {} + } + } +} + +fn correct_conversations_info(method: &mut Method) { + for mut param in &mut method.parameters { + match param.name.as_str() { + // The channel parameter is required + "channel" => param.required = true, + // The Token parameter is required + "token" => param.required = true, + _ => {} + } + } + if let ResponseType::Object(o) = &mut method.response.r#type { + for t in o { + match t.name.as_str() { + // channel is defined as Vec<_> but returns a single _ + "channel" => { + if let ResponseType::Vec(v) = &mut t.r#type.r#type { + t.r#type = (**v).clone(); + } + } + _ => {} + } + } + } +} + +fn correct_conversations_list(method: &mut Method) { + for mut param in &mut method.parameters { + match param.name.as_str() { + // The Token parameter is required + "token" => param.required = true, + _ => {} + } + } + if let ResponseType::Object(o) = &mut method.response.r#type { + for t in o { + match t.name.as_str() { + // channels is defined as Vec> but the endpoint returns Vec<_> + "channels" => dedup_vec(&mut t.r#type.r#type), + _ => {} + } + } + } +} + +fn correct_conversations_history(method: &mut Method) { + for mut param in &mut method.parameters { + match param.name.as_str() { + // The channel parameter is required + "channel" => param.required = true, + // The Token parameter is required + "token" => param.required = true, + _ => {} + } + } + if let ResponseType::Object(o) = &mut method.response.r#type { + for t in o { + match t.name.as_str() { + // messages can be null + "messages" => { + t.r#type.required = false; + if let ResponseType::Vec(v) = &mut t.r#type.r#type { + if let ResponseType::Object(o) = &mut v.r#type { + for t in o { + match t.name.as_str() { + // attachments is not a vec + "attachments" => { + if let ResponseType::Vec(v) = &mut t.r#type.r#type { + if let ResponseType::Object(o) = &mut v.r#type { + for t in o { + match t.name.as_str() { + // id is not required + "id" => t.r#type.required = false, + _ => {} + } + } + } + } + } + // bot_id is not a vec + "bot_id" => { + if let ResponseType::Vec(v) = &t.r#type.r#type { + t.r#type = (**v).clone(); + t.r#type.required = false; + } + } + _ => {} + } + } + } + } + } + // channel_actions_ts can be null + "channel_actions_ts" => t.r#type.required = false, + _ => {} + } + } + } +} + +fn dedup_vec(r#type: &mut ResponseType) { + if let ResponseType::Vec(v) = r#type { + if let ResponseType::Vec(vi) = &v.r#type { + *v = vi.clone(); + } + } +} diff --git a/codegen/src/main.rs b/codegen/src/main.rs index 96bbbc33..8c9ab4bc 100644 --- a/codegen/src/main.rs +++ b/codegen/src/main.rs @@ -3,16 +3,13 @@ use std::collections::HashMap; use std::convert::TryFrom; -use std::fmt; use std::fs; -use std::io::Write; use std::iter::Peekable; use std::path::{Path, PathBuf}; use anyhow::{bail, Context, Result}; use clap::{App, Arg}; use reqwest::blocking::Client; -use serde::Serialize; mod rust; use rust::{GenMode, HttpMethod, Method, Module, ModuleBuilder, Parameter, Response}; @@ -20,6 +17,9 @@ use rust::{GenMode, HttpMethod, Method, Module, ModuleBuilder, Parameter, Respon mod schema; use schema::{EnumValues, Operation, PathItem, Spec}; +mod adapt; +use adapt::correct; + mod vec_or_single; const DEFAULT_OUT_DIR: &str = concat!(env!("CARGO_MANIFEST_DIR"), "/../src"); @@ -33,9 +33,8 @@ fn main() -> Result<()> { let arguments = handle_arguments()?; let mut spec = fetch_slack_api_spec()?; spec.replace_refs()?; - let modules = transform_to_modules(&spec)?; - debug(&modules); - debug_json(&spec.paths); + let mut modules = transform_to_modules(&spec)?; + correct(&mut modules); generate(&arguments.outdir, &modules)?; Ok(()) } @@ -78,21 +77,6 @@ fn fetch_slack_api_spec() -> Result { .context("Unable to deserialize slack server response") } -fn debug(data: D) { - std::fs::File::create("/tmp_crypt/slack.debug") - .unwrap() - .write_all(format!("{:#?}", data).as_bytes()) - .unwrap(); -} - -fn debug_json(data: D) { - let data = serde_json::to_string_pretty(&data).expect("Unable to serialize debug data"); - std::fs::File::create("/tmp_crypt/slack.json") - .unwrap() - .write_all(data.as_bytes()) - .unwrap(); -} - fn transform_to_modules(spec: &Spec) -> Result> { let mut modules: HashMap<&str, ModuleBuilder> = HashMap::new(); for (full_name, path) in &spec.paths { @@ -219,8 +203,7 @@ fn create_method( }; for parameter in &op.parameters { let parameter = match parameter.location.as_ref() { - "header" if parameter.name == "token" => continue, - "query" if parameter.name == "token" => continue, + "header" if parameter.name == "token" => Parameter::try_from(parameter)?, "formData" | "query" => Parameter::try_from(parameter)?, loc => bail!(format!( "Unsupported paramter location {} for {}", diff --git a/codegen/src/rust.rs b/codegen/src/rust.rs index 0ce1eee5..d59c648c 100644 --- a/codegen/src/rust.rs +++ b/codegen/src/rust.rs @@ -180,9 +180,9 @@ impl Module { }; let data = format!( "{header} - #![allow(unused_variables)] #![allow(unused_imports)] - #![allow(dead_code)] + #![allow(clippy::match_single_binding)] + #![allow(clippy::blacklisted_name)] {modules}{imports} @@ -290,6 +290,7 @@ impl Method { let parameters = self .parameters .iter() + .filter(|p| p.name != "token") .map(Parameter::to_rust) .collect::>() .join("\n"); @@ -415,6 +416,7 @@ impl Method { HttpMethod::Get => self .parameters .iter() + .filter(|p| p.name != "token") .map(Parameter::to_rust_fn) .collect::>() .join("\n"), @@ -426,34 +428,59 @@ impl Method { .collect::>() .join("\n"), }; + let token = self.parameters.iter().find(|p| p.name == "token"); let headers = match self.http_method { HttpMethod::Get => "", HttpMethod::Post => { - if let Some(token) = self.parameters.iter().find(|p| p.name == "token") { + if let Some(token) = token { if token.required { - ", &[(\"token\", request.token.clone())]" + ", &[(\"token\", token.to_string())]" } else { - ", &request.token.as_ref().map_or(vec![], |t| vec![(\"token\", t.into())])" + ", &token.map_or(vec![], |t| vec![(\"token\", t.to_string())])" } } else { ", &[]" } } }; + let params = match self.http_method { + HttpMethod::Post => "", + HttpMethod::Get => { + if let Some(token) = token { + if token.required { + "Some((\"token\", token.to_string()))," + } else { + "token.map(|token| (\"token\", token.to_string()))," + } + } else { + "" + } + } + }; + let token_param = if let Some(token) = token { + if token.required { + "token: &str," + } else { + "token: Option<&str>," + } + } else { + "" + }; + let empty_param = if parameters.is_empty() { "_" } else { "" }; let out = format!( "/// {description} /// /// Wraps {doc_url} pub {fn_type} {fn_name}( - client: &R, - request: &{request_type}, + client: &R,{token_param} + {empty_param}request: &{request_type}, ) -> Result<{response_type}, {error_type}> where R: SlackWebRequestSender, {{ let params = vec![ - {parameters} + {params}{parameters} ]; let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method(\"{full_name}\"); @@ -477,6 +504,9 @@ impl Method { parameters = parameters, method=self.http_method.method(), headers=headers, + token_param=token_param, + params = params, + empty_param = empty_param ); Ok(out) } @@ -538,6 +568,7 @@ impl TryFrom<&schema::Parameter> for Parameter { #[derive(Clone, Debug)] pub enum ParameterDataType { Bool, + Decimal, Int, String, } @@ -546,6 +577,7 @@ impl ParameterDataType { pub fn to_rust(&self, required: bool) -> String { let r#type = match self { Self::Bool => "bool", + Self::Decimal => "f64", Self::Int => "u64", Self::String => "String", }; @@ -563,7 +595,8 @@ impl FromStr for ParameterDataType { fn from_str(s: &str) -> Result { let r#type = match s { "boolean" => Self::Bool, - "integer" | "number" => Self::Int, + "integer" => Self::Int, + "number" => Self::Decimal, "string" => Self::String, t => bail!(format!("Type {} currently not supported", t)), }; @@ -590,6 +623,7 @@ impl Response { let res = match &self.r#type { // Inner ResponseType::Bool if !top => ("bool".into(), Vec::new()), + ResponseType::Decimal if !top => ("f64".into(), Vec::new()), ResponseType::Int if !top => ("u64".into(), Vec::new()), ResponseType::String if !top => ("String".into(), Vec::new()), ResponseType::RawJson if !top => ("serde_json::Value".into(), Vec::new()), @@ -742,6 +776,7 @@ impl TryFrom<(&str, &schema::Schema)> for Member { #[derive(Clone, Debug)] pub enum ResponseType { Bool, + Decimal, Int, String, Object(Vec), @@ -770,7 +805,7 @@ impl TryFrom<&schema::Schema> for ResponseType { // Primitives (Some(schema), _, _) if schema.contains(&"boolean") => Self::Bool, (Some(schema), _, _) if schema.contains(&"integer") => Self::Int, - (Some(schema), _, _) if schema.contains(&"number") => Self::Int, + (Some(schema), _, _) if schema.contains(&"number") => Self::Decimal, (Some(schema), _, _) if schema.contains(&"string") => Self::String, // Object diff --git a/examples/channel_history.rs b/examples/channel_history.rs index cd0cdbc7..3e5d88dc 100644 --- a/examples/channel_history.rs +++ b/examples/channel_history.rs @@ -9,14 +9,14 @@ async fn main() -> Result<(), Box> { let token = env::var("SLACK_API_TOKEN").map_err(|_| "SLACK_API_TOKEN env var must be set")?; let client = slack::default_client().map_err(|_| "Could not get default_client")?; - let response = slack::channels::history( + let response = slack::conversations::history( &client, &token, - &slack::channels::HistoryRequest { - channel: &env::args() + &slack::conversations::HistoryRequest { + channel: env::args() .nth(1) .ok_or("must specify channel id as argument e.g. C09123456")?, - ..slack::channels::HistoryRequest::default() + ..slack::conversations::HistoryRequest::default() }, ) .await; diff --git a/examples/channel_history_sync.rs b/examples/channel_history_sync.rs index 6fadc0b7..94d5828b 100644 --- a/examples/channel_history_sync.rs +++ b/examples/channel_history_sync.rs @@ -8,14 +8,14 @@ fn main() -> Result<(), Box> { let token = env::var("SLACK_API_TOKEN").map_err(|_| "SLACK_API_TOKEN env var must be set")?; let client = slack::default_client().map_err(|_| "Could not get default_client")?; - let response = slack::channels::history( + let response = slack::conversations::history( &client, &token, - &slack::channels::HistoryRequest { - channel: &env::args() + &slack::conversations::HistoryRequest { + channel: env::args() .nth(1) .ok_or("must specify channel id as argument e.g. C09123456")?, - ..slack::channels::HistoryRequest::default() + ..slack::conversations::HistoryRequest::default() }, ); diff --git a/examples/start_rtm.rs b/examples/start_rtm.rs deleted file mode 100644 index b64f82c0..00000000 --- a/examples/start_rtm.rs +++ /dev/null @@ -1,41 +0,0 @@ -use slack_api as slack; - -use std::default::Default; -use std::env; - -#[tokio::main] -async fn main() -> Result<(), Box> { - // You can generate a legacy token to quickly test these apis - // https://api.slack.com/custom-integrations/legacy-tokens - let token = env::var("SLACK_API_TOKEN").map_err(|_| "SLACK_API_TOKEN env var must be set")?; - let client = - slack::default_client().map_err(|e| format!("Could not get default_client, {:?}", e))?; - - { - let request = slack::rtm::StartRequest::default(); - let response = slack::rtm::start(&client, &token, &request).await; - - if let Ok(response) = response { - if let Some(channels) = response.channels { - let channel_names = channels - .iter() - .filter_map(|c| c.name.as_ref()) - .collect::>(); - - println!("Got channels: {:?}", channel_names); - } - - if let Some(users) = response.users { - let user_names = users - .iter() - .filter_map(|u| u.name.as_ref()) - .collect::>(); - - println!("Got users: {:?}", user_names); - } - } else { - println!("{:?}", response); - } - } - Ok(()) -} diff --git a/src/async_impl/mods/admin/apps/approved.rs b/src/async_impl/mods/admin/apps/approved.rs index b9c35f55..a775f9bd 100644 --- a/src/async_impl/mods/admin/apps/approved.rs +++ b/src/async_impl/mods/admin/apps/approved.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use crate::async_impl::SlackWebRequestSender; pub use crate::mod_types::admin::apps::approved_types::*; @@ -23,11 +23,16 @@ pub use crate::mod_types::admin::apps::approved_types::*; /// /// Wraps https://api.slack.com/methods/admin.apps.approved.list -pub async fn list(client: &R, request: &ListRequest) -> Result> +pub async fn list( + client: &R, + token: &str, + request: &ListRequest, +) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), request .cursor .as_ref() diff --git a/src/async_impl/mods/admin/apps/mod.rs b/src/async_impl/mods/admin/apps/mod.rs index a0ae8068..e5306502 100644 --- a/src/async_impl/mods/admin/apps/mod.rs +++ b/src/async_impl/mods/admin/apps/mod.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub mod approved; pub mod requests; @@ -29,6 +29,7 @@ pub use crate::mod_types::admin::apps::*; pub async fn approve( client: &R, + token: &str, request: &ApproveRequest, ) -> Result> where @@ -51,7 +52,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.apps.approve"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(ApproveError::Client) .and_then(|result| { @@ -65,6 +66,7 @@ where pub async fn restrict( client: &R, + token: &str, request: &RestrictRequest, ) -> Result> where @@ -87,7 +89,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.apps.restrict"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(RestrictError::Client) .and_then(|result| { diff --git a/src/async_impl/mods/admin/apps/requests.rs b/src/async_impl/mods/admin/apps/requests.rs index c88015ab..7e0be123 100644 --- a/src/async_impl/mods/admin/apps/requests.rs +++ b/src/async_impl/mods/admin/apps/requests.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use crate::async_impl::SlackWebRequestSender; pub use crate::mod_types::admin::apps::requests_types::*; @@ -23,11 +23,16 @@ pub use crate::mod_types::admin::apps::requests_types::*; /// /// Wraps https://api.slack.com/methods/admin.apps.requests.list -pub async fn list(client: &R, request: &ListRequest) -> Result> +pub async fn list( + client: &R, + token: &str, + request: &ListRequest, +) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), request .cursor .as_ref() diff --git a/src/async_impl/mods/admin/apps/restricted.rs b/src/async_impl/mods/admin/apps/restricted.rs index ac6a6dfc..646a4788 100644 --- a/src/async_impl/mods/admin/apps/restricted.rs +++ b/src/async_impl/mods/admin/apps/restricted.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use crate::async_impl::SlackWebRequestSender; pub use crate::mod_types::admin::apps::restricted_types::*; @@ -23,11 +23,16 @@ pub use crate::mod_types::admin::apps::restricted_types::*; /// /// Wraps https://api.slack.com/methods/admin.apps.restricted.list -pub async fn list(client: &R, request: &ListRequest) -> Result> +pub async fn list( + client: &R, + token: &str, + request: &ListRequest, +) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), request .cursor .as_ref() diff --git a/src/async_impl/mods/admin/conversations/ekm.rs b/src/async_impl/mods/admin/conversations/ekm.rs index 5f55eac2..53505eb0 100644 --- a/src/async_impl/mods/admin/conversations/ekm.rs +++ b/src/async_impl/mods/admin/conversations/ekm.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use crate::async_impl::SlackWebRequestSender; pub use crate::mod_types::admin::conversations::ekm_types::*; @@ -25,12 +25,14 @@ pub use crate::mod_types::admin::conversations::ekm_types::*; pub async fn list_original_connected_channel_info( client: &R, + token: &str, request: &ListOriginalConnectedChannelInfoRequest, ) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), request .channel_ids .as_ref() diff --git a/src/async_impl/mods/admin/conversations/mod.rs b/src/async_impl/mods/admin/conversations/mod.rs index 953102b4..9a162b61 100644 --- a/src/async_impl/mods/admin/conversations/mod.rs +++ b/src/async_impl/mods/admin/conversations/mod.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub mod ekm; pub mod restrict_access; @@ -28,6 +28,7 @@ pub use crate::mod_types::admin::conversations::*; pub async fn archive( client: &R, + token: &str, request: &ArchiveRequest, ) -> Result> where @@ -37,7 +38,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.conversations.archive"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(ArchiveError::Client) .and_then(|result| { @@ -51,6 +52,7 @@ where pub async fn convert_to_private( client: &R, + token: &str, request: &ConvertToPrivateRequest, ) -> Result> where @@ -60,7 +62,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.conversations.convertToPrivate"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(ConvertToPrivateError::Client) .and_then(|result| { @@ -74,6 +76,7 @@ where pub async fn create( client: &R, + token: &str, request: &CreateRequest, ) -> Result> where @@ -98,7 +101,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.conversations.create"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(CreateError::Client) .and_then(|result| { @@ -112,6 +115,7 @@ where pub async fn delete( client: &R, + token: &str, request: &DeleteRequest, ) -> Result> where @@ -121,7 +125,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.conversations.delete"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(DeleteError::Client) .and_then(|result| { @@ -135,6 +139,7 @@ where pub async fn disconnect_shared( client: &R, + token: &str, request: &DisconnectSharedRequest, ) -> Result> where @@ -150,7 +155,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.conversations.disconnectShared"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(DisconnectSharedError::Client) .and_then(|result| { @@ -164,12 +169,16 @@ where pub async fn get_conversation_prefs( client: &R, + token: &str, request: &GetConversationPrefsRequest, ) -> Result> where R: SlackWebRequestSender, { - let params = vec![Some(("channel_id", request.channel_id.to_string()))]; + let params = vec![ + Some(("token", token.to_string())), + Some(("channel_id", request.channel_id.to_string())), + ]; let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.conversations.getConversationPrefs"); client @@ -187,12 +196,14 @@ where pub async fn get_teams( client: &R, + token: &str, request: &GetTeamsRequest, ) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), Some(("channel_id", request.channel_id.to_string())), request .cursor @@ -220,6 +231,7 @@ where pub async fn invite( client: &R, + token: &str, request: &InviteRequest, ) -> Result> where @@ -232,7 +244,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.conversations.invite"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(InviteError::Client) .and_then(|result| { @@ -246,6 +258,7 @@ where pub async fn rename( client: &R, + token: &str, request: &RenameRequest, ) -> Result> where @@ -258,7 +271,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.conversations.rename"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(RenameError::Client) .and_then(|result| { @@ -272,12 +285,14 @@ where pub async fn search( client: &R, + token: &str, request: &SearchRequest, ) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), request .cursor .as_ref() @@ -321,6 +336,7 @@ where pub async fn set_conversation_prefs( client: &R, + token: &str, request: &SetConversationPrefsRequest, ) -> Result> where @@ -333,7 +349,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.conversations.setConversationPrefs"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(SetConversationPrefsError::Client) .and_then(|result| { @@ -347,6 +363,7 @@ where pub async fn set_teams( client: &R, + token: &str, request: &SetTeamsRequest, ) -> Result> where @@ -370,7 +387,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.conversations.setTeams"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(SetTeamsError::Client) .and_then(|result| { @@ -384,6 +401,7 @@ where pub async fn unarchive( client: &R, + token: &str, request: &UnarchiveRequest, ) -> Result> where @@ -393,7 +411,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.conversations.unarchive"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(UnarchiveError::Client) .and_then(|result| { diff --git a/src/async_impl/mods/admin/conversations/restrict_access.rs b/src/async_impl/mods/admin/conversations/restrict_access.rs index 7d0d50e4..9af046be 100644 --- a/src/async_impl/mods/admin/conversations/restrict_access.rs +++ b/src/async_impl/mods/admin/conversations/restrict_access.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use crate::async_impl::SlackWebRequestSender; pub use crate::mod_types::admin::conversations::restrict_access_types::*; @@ -25,6 +25,7 @@ pub use crate::mod_types::admin::conversations::restrict_access_types::*; pub async fn add_group( client: &R, + token: &str, request: &AddGroupRequest, ) -> Result> where @@ -41,7 +42,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.conversations.restrictAccess.addGroup"); client - .post(&url, ¶ms[..], &[("token", request.token.clone())]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(AddGroupError::Client) .and_then(|result| { @@ -55,12 +56,14 @@ where pub async fn list_groups( client: &R, + token: &str, request: &ListGroupsRequest, ) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), Some(("channel_id", request.channel_id.to_string())), request .team_id @@ -84,6 +87,7 @@ where pub async fn remove_group( client: &R, + token: &str, request: &RemoveGroupRequest, ) -> Result> where @@ -97,7 +101,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.conversations.restrictAccess.removeGroup"); client - .post(&url, ¶ms[..], &[("token", request.token.clone())]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(RemoveGroupError::Client) .and_then(|result| { diff --git a/src/async_impl/mods/admin/emoji.rs b/src/async_impl/mods/admin/emoji.rs index 5156757d..772e9b72 100644 --- a/src/async_impl/mods/admin/emoji.rs +++ b/src/async_impl/mods/admin/emoji.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use crate::async_impl::SlackWebRequestSender; pub use crate::mod_types::admin::emoji_types::*; @@ -23,7 +23,11 @@ pub use crate::mod_types::admin::emoji_types::*; /// /// Wraps https://api.slack.com/methods/admin.emoji.add -pub async fn add(client: &R, request: &AddRequest) -> Result> +pub async fn add( + client: &R, + token: &str, + request: &AddRequest, +) -> Result> where R: SlackWebRequestSender, { @@ -34,7 +38,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.emoji.add"); client - .post(&url, ¶ms[..], &[("token", request.token.clone())]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(AddError::Client) .and_then(|result| { @@ -48,6 +52,7 @@ where pub async fn add_alias( client: &R, + token: &str, request: &AddAliasRequest, ) -> Result> where @@ -60,7 +65,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.emoji.addAlias"); client - .post(&url, ¶ms[..], &[("token", request.token.clone())]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(AddAliasError::Client) .and_then(|result| { @@ -72,11 +77,16 @@ where /// /// Wraps https://api.slack.com/methods/admin.emoji.list -pub async fn list(client: &R, request: &ListRequest) -> Result> +pub async fn list( + client: &R, + token: &str, + request: &ListRequest, +) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), request .cursor .as_ref() @@ -103,6 +113,7 @@ where pub async fn remove( client: &R, + token: &str, request: &RemoveRequest, ) -> Result> where @@ -112,7 +123,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.emoji.remove"); client - .post(&url, ¶ms[..], &[("token", request.token.clone())]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(RemoveError::Client) .and_then(|result| { @@ -126,6 +137,7 @@ where pub async fn rename( client: &R, + token: &str, request: &RenameRequest, ) -> Result> where @@ -138,7 +150,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.emoji.rename"); client - .post(&url, ¶ms[..], &[("token", request.token.clone())]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(RenameError::Client) .and_then(|result| { diff --git a/src/async_impl/mods/admin/invite_requests/approved.rs b/src/async_impl/mods/admin/invite_requests/approved.rs index 1873a1c4..47731779 100644 --- a/src/async_impl/mods/admin/invite_requests/approved.rs +++ b/src/async_impl/mods/admin/invite_requests/approved.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use crate::async_impl::SlackWebRequestSender; pub use crate::mod_types::admin::invite_requests::approved_types::*; @@ -23,11 +23,16 @@ pub use crate::mod_types::admin::invite_requests::approved_types::*; /// /// Wraps https://api.slack.com/methods/admin.inviteRequests.approved.list -pub async fn list(client: &R, request: &ListRequest) -> Result> +pub async fn list( + client: &R, + token: &str, + request: &ListRequest, +) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), request .cursor .as_ref() diff --git a/src/async_impl/mods/admin/invite_requests/denied.rs b/src/async_impl/mods/admin/invite_requests/denied.rs index 680aface..9bfca8dc 100644 --- a/src/async_impl/mods/admin/invite_requests/denied.rs +++ b/src/async_impl/mods/admin/invite_requests/denied.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use crate::async_impl::SlackWebRequestSender; pub use crate::mod_types::admin::invite_requests::denied_types::*; @@ -23,11 +23,16 @@ pub use crate::mod_types::admin::invite_requests::denied_types::*; /// /// Wraps https://api.slack.com/methods/admin.inviteRequests.denied.list -pub async fn list(client: &R, request: &ListRequest) -> Result> +pub async fn list( + client: &R, + token: &str, + request: &ListRequest, +) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), request .cursor .as_ref() diff --git a/src/async_impl/mods/admin/invite_requests/mod.rs b/src/async_impl/mods/admin/invite_requests/mod.rs index 6b9a52d7..aeeab576 100644 --- a/src/async_impl/mods/admin/invite_requests/mod.rs +++ b/src/async_impl/mods/admin/invite_requests/mod.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub mod approved; pub mod denied; @@ -28,6 +28,7 @@ pub use crate::mod_types::admin::invite_requests::*; pub async fn approve( client: &R, + token: &str, request: &ApproveRequest, ) -> Result> where @@ -43,7 +44,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.inviteRequests.approve"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(ApproveError::Client) .and_then(|result| { @@ -55,7 +56,11 @@ where /// /// Wraps https://api.slack.com/methods/admin.inviteRequests.deny -pub async fn deny(client: &R, request: &DenyRequest) -> Result> +pub async fn deny( + client: &R, + token: &str, + request: &DenyRequest, +) -> Result> where R: SlackWebRequestSender, { @@ -69,7 +74,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.inviteRequests.deny"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(DenyError::Client) .and_then(|result| { @@ -81,11 +86,16 @@ where /// /// Wraps https://api.slack.com/methods/admin.inviteRequests.list -pub async fn list(client: &R, request: &ListRequest) -> Result> +pub async fn list( + client: &R, + token: &str, + request: &ListRequest, +) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), request .cursor .as_ref() diff --git a/src/async_impl/mods/admin/mod.rs b/src/async_impl/mods/admin/mod.rs index 1ebdab33..e149f7b7 100644 --- a/src/async_impl/mods/admin/mod.rs +++ b/src/async_impl/mods/admin/mod.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub mod apps; pub mod conversations; diff --git a/src/async_impl/mods/admin/teams/admins.rs b/src/async_impl/mods/admin/teams/admins.rs index 516c0c6d..915fefcc 100644 --- a/src/async_impl/mods/admin/teams/admins.rs +++ b/src/async_impl/mods/admin/teams/admins.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use crate::async_impl::SlackWebRequestSender; pub use crate::mod_types::admin::teams::admins_types::*; @@ -23,11 +23,16 @@ pub use crate::mod_types::admin::teams::admins_types::*; /// /// Wraps https://api.slack.com/methods/admin.teams.admins.list -pub async fn list(client: &R, request: &ListRequest) -> Result> +pub async fn list( + client: &R, + token: &str, + request: &ListRequest, +) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), request .cursor .as_ref() diff --git a/src/async_impl/mods/admin/teams/mod.rs b/src/async_impl/mods/admin/teams/mod.rs index da1e9df6..bddace57 100644 --- a/src/async_impl/mods/admin/teams/mod.rs +++ b/src/async_impl/mods/admin/teams/mod.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub mod admins; pub mod owners; @@ -29,6 +29,7 @@ pub use crate::mod_types::admin::teams::*; pub async fn create( client: &R, + token: &str, request: &CreateRequest, ) -> Result> where @@ -49,7 +50,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.teams.create"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(CreateError::Client) .and_then(|result| { @@ -61,11 +62,16 @@ where /// /// Wraps https://api.slack.com/methods/admin.teams.list -pub async fn list(client: &R, request: &ListRequest) -> Result> +pub async fn list( + client: &R, + token: &str, + request: &ListRequest, +) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), request .cursor .as_ref() diff --git a/src/async_impl/mods/admin/teams/owners.rs b/src/async_impl/mods/admin/teams/owners.rs index 34bdf6d4..08e660ca 100644 --- a/src/async_impl/mods/admin/teams/owners.rs +++ b/src/async_impl/mods/admin/teams/owners.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use crate::async_impl::SlackWebRequestSender; pub use crate::mod_types::admin::teams::owners_types::*; @@ -23,11 +23,16 @@ pub use crate::mod_types::admin::teams::owners_types::*; /// /// Wraps https://api.slack.com/methods/admin.teams.owners.list -pub async fn list(client: &R, request: &ListRequest) -> Result> +pub async fn list( + client: &R, + token: &str, + request: &ListRequest, +) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), request .cursor .as_ref() diff --git a/src/async_impl/mods/admin/teams/settings.rs b/src/async_impl/mods/admin/teams/settings.rs index 80281bde..5c3f60e6 100644 --- a/src/async_impl/mods/admin/teams/settings.rs +++ b/src/async_impl/mods/admin/teams/settings.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use crate::async_impl::SlackWebRequestSender; pub use crate::mod_types::admin::teams::settings_types::*; @@ -23,11 +23,18 @@ pub use crate::mod_types::admin::teams::settings_types::*; /// /// Wraps https://api.slack.com/methods/admin.teams.settings.info -pub async fn info(client: &R, request: &InfoRequest) -> Result> +pub async fn info( + client: &R, + token: &str, + request: &InfoRequest, +) -> Result> where R: SlackWebRequestSender, { - let params = vec![Some(("team_id", request.team_id.to_string()))]; + let params = vec![ + Some(("token", token.to_string())), + Some(("team_id", request.team_id.to_string())), + ]; let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.teams.settings.info"); client @@ -45,6 +52,7 @@ where pub async fn set_default_channels( client: &R, + token: &str, request: &SetDefaultChannelsRequest, ) -> Result> where @@ -57,7 +65,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.teams.settings.setDefaultChannels"); client - .post(&url, ¶ms[..], &[("token", request.token.clone())]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(SetDefaultChannelsError::Client) .and_then(|result| { @@ -71,6 +79,7 @@ where pub async fn set_description( client: &R, + token: &str, request: &SetDescriptionRequest, ) -> Result> where @@ -83,7 +92,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.teams.settings.setDescription"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(SetDescriptionError::Client) .and_then(|result| { @@ -97,6 +106,7 @@ where pub async fn set_discoverability( client: &R, + token: &str, request: &SetDiscoverabilityRequest, ) -> Result> where @@ -109,7 +119,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.teams.settings.setDiscoverability"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(SetDiscoverabilityError::Client) .and_then(|result| { @@ -123,6 +133,7 @@ where pub async fn set_icon( client: &R, + token: &str, request: &SetIconRequest, ) -> Result> where @@ -135,7 +146,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.teams.settings.setIcon"); client - .post(&url, ¶ms[..], &[("token", request.token.clone())]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(SetIconError::Client) .and_then(|result| { @@ -149,6 +160,7 @@ where pub async fn set_name( client: &R, + token: &str, request: &SetNameRequest, ) -> Result> where @@ -161,7 +173,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.teams.settings.setName"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(SetNameError::Client) .and_then(|result| { diff --git a/src/async_impl/mods/admin/usergroups.rs b/src/async_impl/mods/admin/usergroups.rs index 336d28e7..54b4b6c0 100644 --- a/src/async_impl/mods/admin/usergroups.rs +++ b/src/async_impl/mods/admin/usergroups.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use crate::async_impl::SlackWebRequestSender; pub use crate::mod_types::admin::usergroups_types::*; @@ -25,6 +25,7 @@ pub use crate::mod_types::admin::usergroups_types::*; pub async fn add_channels( client: &R, + token: &str, request: &AddChannelsRequest, ) -> Result> where @@ -41,7 +42,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.usergroups.addChannels"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(AddChannelsError::Client) .and_then(|result| { @@ -55,6 +56,7 @@ where pub async fn add_teams( client: &R, + token: &str, request: &AddTeamsRequest, ) -> Result> where @@ -71,7 +73,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.usergroups.addTeams"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(AddTeamsError::Client) .and_then(|result| { @@ -85,12 +87,14 @@ where pub async fn list_channels( client: &R, + token: &str, request: &ListChannelsRequest, ) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), request .include_num_members .as_ref() @@ -118,6 +122,7 @@ where pub async fn remove_channels( client: &R, + token: &str, request: &RemoveChannelsRequest, ) -> Result> where @@ -130,7 +135,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.usergroups.removeChannels"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(RemoveChannelsError::Client) .and_then(|result| { diff --git a/src/async_impl/mods/admin/users/mod.rs b/src/async_impl/mods/admin/users/mod.rs index 2225a766..36e48057 100644 --- a/src/async_impl/mods/admin/users/mod.rs +++ b/src/async_impl/mods/admin/users/mod.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub mod session; @@ -27,6 +27,7 @@ pub use crate::mod_types::admin::users::*; pub async fn assign( client: &R, + token: &str, request: &AssignRequest, ) -> Result> where @@ -51,7 +52,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.users.assign"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(AssignError::Client) .and_then(|result| { @@ -65,6 +66,7 @@ where pub async fn invite( client: &R, + token: &str, request: &InviteRequest, ) -> Result> where @@ -102,7 +104,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.users.invite"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(InviteError::Client) .and_then(|result| { @@ -114,11 +116,16 @@ where /// /// Wraps https://api.slack.com/methods/admin.users.list -pub async fn list(client: &R, request: &ListRequest) -> Result> +pub async fn list( + client: &R, + token: &str, + request: &ListRequest, +) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), request .cursor .as_ref() @@ -146,6 +153,7 @@ where pub async fn remove( client: &R, + token: &str, request: &RemoveRequest, ) -> Result> where @@ -158,7 +166,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.users.remove"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(RemoveError::Client) .and_then(|result| { @@ -172,6 +180,7 @@ where pub async fn set_admin( client: &R, + token: &str, request: &SetAdminRequest, ) -> Result> where @@ -184,7 +193,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.users.setAdmin"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(SetAdminError::Client) .and_then(|result| { @@ -198,6 +207,7 @@ where pub async fn set_expiration( client: &R, + token: &str, request: &SetExpirationRequest, ) -> Result> where @@ -211,7 +221,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.users.setExpiration"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(SetExpirationError::Client) .and_then(|result| { @@ -225,6 +235,7 @@ where pub async fn set_owner( client: &R, + token: &str, request: &SetOwnerRequest, ) -> Result> where @@ -237,7 +248,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.users.setOwner"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(SetOwnerError::Client) .and_then(|result| { @@ -251,6 +262,7 @@ where pub async fn set_regular( client: &R, + token: &str, request: &SetRegularRequest, ) -> Result> where @@ -263,7 +275,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.users.setRegular"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(SetRegularError::Client) .and_then(|result| { diff --git a/src/async_impl/mods/admin/users/session.rs b/src/async_impl/mods/admin/users/session.rs index 72e3fe0d..37f57f7a 100644 --- a/src/async_impl/mods/admin/users/session.rs +++ b/src/async_impl/mods/admin/users/session.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use crate::async_impl::SlackWebRequestSender; pub use crate::mod_types::admin::users::session_types::*; @@ -25,6 +25,7 @@ pub use crate::mod_types::admin::users::session_types::*; pub async fn invalidate( client: &R, + token: &str, request: &InvalidateRequest, ) -> Result> where @@ -37,7 +38,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.users.session.invalidate"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(InvalidateError::Client) .and_then(|result| { @@ -51,6 +52,7 @@ where pub async fn reset( client: &R, + token: &str, request: &ResetRequest, ) -> Result> where @@ -70,7 +72,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.users.session.reset"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(ResetError::Client) .and_then(|result| { diff --git a/src/async_impl/mods/api.rs b/src/async_impl/mods/api.rs index 13ead5c0..8d2d0813 100644 --- a/src/async_impl/mods/api.rs +++ b/src/async_impl/mods/api.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use crate::async_impl::SlackWebRequestSender; pub use crate::mod_types::api_types::*; diff --git a/src/async_impl/mods/apps/event/authorizations.rs b/src/async_impl/mods/apps/event/authorizations.rs index e9b803bb..308199c6 100644 --- a/src/async_impl/mods/apps/event/authorizations.rs +++ b/src/async_impl/mods/apps/event/authorizations.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use crate::async_impl::SlackWebRequestSender; pub use crate::mod_types::apps::event::authorizations_types::*; @@ -23,11 +23,16 @@ pub use crate::mod_types::apps::event::authorizations_types::*; /// /// Wraps https://api.slack.com/methods/apps.event.authorizations.list -pub async fn list(client: &R, request: &ListRequest) -> Result> +pub async fn list( + client: &R, + token: &str, + request: &ListRequest, +) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), request .cursor .as_ref() diff --git a/src/async_impl/mods/apps/event/mod.rs b/src/async_impl/mods/apps/event/mod.rs index 2f8ab693..ad0b3300 100644 --- a/src/async_impl/mods/apps/event/mod.rs +++ b/src/async_impl/mods/apps/event/mod.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub mod authorizations; diff --git a/src/async_impl/mods/apps/mod.rs b/src/async_impl/mods/apps/mod.rs index fa32f2b6..6d5ad79f 100644 --- a/src/async_impl/mods/apps/mod.rs +++ b/src/async_impl/mods/apps/mod.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub mod event; pub mod permissions; @@ -28,12 +28,14 @@ pub use crate::mod_types::apps::*; pub async fn uninstall( client: &R, + token: Option<&str>, request: &UninstallRequest, ) -> Result> where R: SlackWebRequestSender, { let params = vec![ + token.map(|token| ("token", token.to_string())), request .client_id .as_ref() diff --git a/src/async_impl/mods/apps/permissions/mod.rs b/src/async_impl/mods/apps/permissions/mod.rs index 24c430e5..e6fd3f07 100644 --- a/src/async_impl/mods/apps/permissions/mod.rs +++ b/src/async_impl/mods/apps/permissions/mod.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub mod resources; pub mod scopes; @@ -27,11 +27,15 @@ pub use crate::mod_types::apps::permissions::*; /// /// Wraps https://api.slack.com/methods/apps.permissions.info -pub async fn info(client: &R, request: &InfoRequest) -> Result> +pub async fn info( + client: &R, + token: Option<&str>, + _request: &InfoRequest, +) -> Result> where R: SlackWebRequestSender, { - let params = vec![]; + let params = vec![token.map(|token| ("token", token.to_string()))]; let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/apps.permissions.info"); client @@ -49,12 +53,14 @@ where pub async fn request( client: &R, + token: &str, request: &RequestRequest, ) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), Some(("scopes", request.scopes.to_string())), Some(("trigger_id", request.trigger_id.to_string())), ]; diff --git a/src/async_impl/mods/apps/permissions/resources.rs b/src/async_impl/mods/apps/permissions/resources.rs index 2399f2d1..43ab6892 100644 --- a/src/async_impl/mods/apps/permissions/resources.rs +++ b/src/async_impl/mods/apps/permissions/resources.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use crate::async_impl::SlackWebRequestSender; pub use crate::mod_types::apps::permissions::resources_types::*; @@ -23,11 +23,16 @@ pub use crate::mod_types::apps::permissions::resources_types::*; /// /// Wraps https://api.slack.com/methods/apps.permissions.resources.list -pub async fn list(client: &R, request: &ListRequest) -> Result> +pub async fn list( + client: &R, + token: &str, + request: &ListRequest, +) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), request .cursor .as_ref() diff --git a/src/async_impl/mods/apps/permissions/scopes.rs b/src/async_impl/mods/apps/permissions/scopes.rs index 957db194..407fdfab 100644 --- a/src/async_impl/mods/apps/permissions/scopes.rs +++ b/src/async_impl/mods/apps/permissions/scopes.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use crate::async_impl::SlackWebRequestSender; pub use crate::mod_types::apps::permissions::scopes_types::*; @@ -23,11 +23,15 @@ pub use crate::mod_types::apps::permissions::scopes_types::*; /// /// Wraps https://api.slack.com/methods/apps.permissions.scopes.list -pub async fn list(client: &R, request: &ListRequest) -> Result> +pub async fn list( + client: &R, + token: &str, + _request: &ListRequest, +) -> Result> where R: SlackWebRequestSender, { - let params = vec![]; + let params = vec![Some(("token", token.to_string()))]; let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/apps.permissions.scopes.list"); client diff --git a/src/async_impl/mods/apps/permissions/users.rs b/src/async_impl/mods/apps/permissions/users.rs index e12bd08e..9cdd2fa3 100644 --- a/src/async_impl/mods/apps/permissions/users.rs +++ b/src/async_impl/mods/apps/permissions/users.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use crate::async_impl::SlackWebRequestSender; pub use crate::mod_types::apps::permissions::users_types::*; @@ -23,11 +23,16 @@ pub use crate::mod_types::apps::permissions::users_types::*; /// /// Wraps https://api.slack.com/methods/apps.permissions.users.list -pub async fn list(client: &R, request: &ListRequest) -> Result> +pub async fn list( + client: &R, + token: &str, + request: &ListRequest, +) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), request .cursor .as_ref() @@ -54,12 +59,14 @@ where pub async fn request( client: &R, + token: &str, request: &RequestRequest, ) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), Some(("scopes", request.scopes.to_string())), Some(("trigger_id", request.trigger_id.to_string())), Some(("user", request.user.to_string())), diff --git a/src/async_impl/mods/auth.rs b/src/async_impl/mods/auth.rs index af4a5805..2c6f54f3 100644 --- a/src/async_impl/mods/auth.rs +++ b/src/async_impl/mods/auth.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use crate::async_impl::SlackWebRequestSender; pub use crate::mod_types::auth_types::*; @@ -25,12 +25,16 @@ pub use crate::mod_types::auth_types::*; pub async fn revoke( client: &R, + token: &str, request: &RevokeRequest, ) -> Result> where R: SlackWebRequestSender, { - let params = vec![request.test.as_ref().map(|test| ("test", test.to_string()))]; + let params = vec![ + Some(("token", token.to_string())), + request.test.as_ref().map(|test| ("test", test.to_string())), + ]; let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/auth.revoke"); client @@ -46,11 +50,15 @@ where /// /// Wraps https://api.slack.com/methods/auth.test -pub async fn test(client: &R, request: &TestRequest) -> Result> +pub async fn test( + client: &R, + token: &str, + _request: &TestRequest, +) -> Result> where R: SlackWebRequestSender, { - let params = vec![]; + let params = vec![Some(("token", token.to_string()))]; let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/auth.test"); client diff --git a/src/async_impl/mods/bots.rs b/src/async_impl/mods/bots.rs index ce5a95fc..4754b72e 100644 --- a/src/async_impl/mods/bots.rs +++ b/src/async_impl/mods/bots.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use crate::async_impl::SlackWebRequestSender; pub use crate::mod_types::bots_types::*; @@ -23,11 +23,18 @@ pub use crate::mod_types::bots_types::*; /// /// Wraps https://api.slack.com/methods/bots.info -pub async fn info(client: &R, request: &InfoRequest) -> Result> +pub async fn info( + client: &R, + token: &str, + request: &InfoRequest, +) -> Result> where R: SlackWebRequestSender, { - let params = vec![request.bot.as_ref().map(|bot| ("bot", bot.to_string()))]; + let params = vec![ + Some(("token", token.to_string())), + request.bot.as_ref().map(|bot| ("bot", bot.to_string())), + ]; let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/bots.info"); client diff --git a/src/async_impl/mods/calls/mod.rs b/src/async_impl/mods/calls/mod.rs index 7c805714..330fc782 100644 --- a/src/async_impl/mods/calls/mod.rs +++ b/src/async_impl/mods/calls/mod.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub mod participants; @@ -25,7 +25,11 @@ pub use crate::mod_types::calls::*; /// /// Wraps https://api.slack.com/methods/calls.add -pub async fn add(client: &R, request: &AddRequest) -> Result> +pub async fn add( + client: &R, + token: &str, + request: &AddRequest, +) -> Result> where R: SlackWebRequestSender, { @@ -60,7 +64,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/calls.add"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(AddError::Client) .and_then(|result| { @@ -72,7 +76,11 @@ where /// /// Wraps https://api.slack.com/methods/calls.end -pub async fn end(client: &R, request: &EndRequest) -> Result> +pub async fn end( + client: &R, + token: &str, + request: &EndRequest, +) -> Result> where R: SlackWebRequestSender, { @@ -86,7 +94,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/calls.end"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(EndError::Client) .and_then(|result| { @@ -98,11 +106,18 @@ where /// /// Wraps https://api.slack.com/methods/calls.info -pub async fn info(client: &R, request: &InfoRequest) -> Result> +pub async fn info( + client: &R, + token: &str, + request: &InfoRequest, +) -> Result> where R: SlackWebRequestSender, { - let params = vec![Some(("id", request.id.to_string()))]; + let params = vec![ + Some(("token", token.to_string())), + Some(("id", request.id.to_string())), + ]; let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/calls.info"); client @@ -120,6 +135,7 @@ where pub async fn update( client: &R, + token: &str, request: &UpdateRequest, ) -> Result> where @@ -143,7 +159,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/calls.update"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(UpdateError::Client) .and_then(|result| { diff --git a/src/async_impl/mods/calls/participants.rs b/src/async_impl/mods/calls/participants.rs index d346bf91..1913b68d 100644 --- a/src/async_impl/mods/calls/participants.rs +++ b/src/async_impl/mods/calls/participants.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use crate::async_impl::SlackWebRequestSender; pub use crate::mod_types::calls::participants_types::*; @@ -23,7 +23,11 @@ pub use crate::mod_types::calls::participants_types::*; /// /// Wraps https://api.slack.com/methods/calls.participants.add -pub async fn add(client: &R, request: &AddRequest) -> Result> +pub async fn add( + client: &R, + token: &str, + request: &AddRequest, +) -> Result> where R: SlackWebRequestSender, { @@ -34,7 +38,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/calls.participants.add"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(AddError::Client) .and_then(|result| { @@ -48,6 +52,7 @@ where pub async fn remove( client: &R, + token: &str, request: &RemoveRequest, ) -> Result> where @@ -60,7 +65,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/calls.participants.remove"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(RemoveError::Client) .and_then(|result| { diff --git a/src/async_impl/mods/chat/mod.rs b/src/async_impl/mods/chat/mod.rs index 22f17987..d20bbc8e 100644 --- a/src/async_impl/mods/chat/mod.rs +++ b/src/async_impl/mods/chat/mod.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub mod scheduled_messages; @@ -27,6 +27,7 @@ pub use crate::mod_types::chat::*; pub async fn delete( client: &R, + token: Option<&str>, request: &DeleteRequest, ) -> Result> where @@ -46,7 +47,11 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/chat.delete"); client - .post(&url, ¶ms[..], &[]) + .post( + &url, + ¶ms[..], + &token.map_or(vec![], |t| vec![("token", t.to_string())]), + ) .await .map_err(DeleteError::Client) .and_then(|result| { @@ -60,6 +65,7 @@ where pub async fn delete_scheduled_message( client: &R, + token: &str, request: &DeleteScheduledMessageRequest, ) -> Result> where @@ -79,7 +85,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/chat.deleteScheduledMessage"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(DeleteScheduledMessageError::Client) .and_then(|result| { @@ -93,12 +99,14 @@ where pub async fn get_permalink( client: &R, + token: &str, request: &GetPermalinkRequest, ) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), Some(("channel", request.channel.to_string())), Some(("message_ts", request.message_ts.to_string())), ]; @@ -119,6 +127,7 @@ where pub async fn me_message( client: &R, + token: Option<&str>, request: &MeMessageRequest, ) -> Result> where @@ -134,7 +143,11 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/chat.meMessage"); client - .post(&url, ¶ms[..], &[]) + .post( + &url, + ¶ms[..], + &token.map_or(vec![], |t| vec![("token", t.to_string())]), + ) .await .map_err(MeMessageError::Client) .and_then(|result| { @@ -148,6 +161,7 @@ where pub async fn post_ephemeral( client: &R, + token: &str, request: &PostEphemeralRequest, ) -> Result> where @@ -197,7 +211,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/chat.postEphemeral"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(PostEphemeralError::Client) .and_then(|result| { @@ -211,6 +225,7 @@ where pub async fn post_message( client: &R, + token: &str, request: &PostMessageRequest, ) -> Result> where @@ -275,7 +290,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/chat.postMessage"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(PostMessageError::Client) .and_then(|result| { @@ -289,6 +304,7 @@ where pub async fn schedule_message( client: &R, + token: Option<&str>, request: &ScheduleMessageRequest, ) -> Result> where @@ -344,7 +360,11 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/chat.scheduleMessage"); client - .post(&url, ¶ms[..], &[]) + .post( + &url, + ¶ms[..], + &token.map_or(vec![], |t| vec![("token", t.to_string())]), + ) .await .map_err(ScheduleMessageError::Client) .and_then(|result| { @@ -358,6 +378,7 @@ where pub async fn unfurl( client: &R, + token: &str, request: &UnfurlRequest, ) -> Result> where @@ -386,7 +407,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/chat.unfurl"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(UnfurlError::Client) .and_then(|result| { @@ -400,6 +421,7 @@ where pub async fn update( client: &R, + token: &str, request: &UpdateRequest, ) -> Result> where @@ -433,7 +455,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/chat.update"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(UpdateError::Client) .and_then(|result| { diff --git a/src/async_impl/mods/chat/scheduled_messages.rs b/src/async_impl/mods/chat/scheduled_messages.rs index cc7da1a6..e04cf343 100644 --- a/src/async_impl/mods/chat/scheduled_messages.rs +++ b/src/async_impl/mods/chat/scheduled_messages.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use crate::async_impl::SlackWebRequestSender; pub use crate::mod_types::chat::scheduled_messages_types::*; @@ -23,11 +23,16 @@ pub use crate::mod_types::chat::scheduled_messages_types::*; /// /// Wraps https://api.slack.com/methods/chat.scheduledMessages.list -pub async fn list(client: &R, request: &ListRequest) -> Result> +pub async fn list( + client: &R, + token: Option<&str>, + request: &ListRequest, +) -> Result> where R: SlackWebRequestSender, { let params = vec![ + token.map(|token| ("token", token.to_string())), request .channel .as_ref() diff --git a/src/async_impl/mods/conversations.rs b/src/async_impl/mods/conversations.rs index eb95f8d4..088a0009 100644 --- a/src/async_impl/mods/conversations.rs +++ b/src/async_impl/mods/conversations.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use crate::async_impl::SlackWebRequestSender; pub use crate::mod_types::conversations_types::*; @@ -25,6 +25,7 @@ pub use crate::mod_types::conversations_types::*; pub async fn archive( client: &R, + token: Option<&str>, request: &ArchiveRequest, ) -> Result> where @@ -37,7 +38,11 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/conversations.archive"); client - .post(&url, ¶ms[..], &[]) + .post( + &url, + ¶ms[..], + &token.map_or(vec![], |t| vec![("token", t.to_string())]), + ) .await .map_err(ArchiveError::Client) .and_then(|result| { @@ -51,6 +56,7 @@ where pub async fn close( client: &R, + token: Option<&str>, request: &CloseRequest, ) -> Result> where @@ -63,7 +69,11 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/conversations.close"); client - .post(&url, ¶ms[..], &[]) + .post( + &url, + ¶ms[..], + &token.map_or(vec![], |t| vec![("token", t.to_string())]), + ) .await .map_err(CloseError::Client) .and_then(|result| { @@ -77,6 +87,7 @@ where pub async fn create( client: &R, + token: Option<&str>, request: &CreateRequest, ) -> Result> where @@ -92,7 +103,11 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/conversations.create"); client - .post(&url, ¶ms[..], &[]) + .post( + &url, + ¶ms[..], + &token.map_or(vec![], |t| vec![("token", t.to_string())]), + ) .await .map_err(CreateError::Client) .and_then(|result| { @@ -106,16 +121,15 @@ where pub async fn history( client: &R, + token: &str, request: &HistoryRequest, ) -> Result> where R: SlackWebRequestSender, { let params = vec![ - request - .channel - .as_ref() - .map(|channel| ("channel", channel.to_string())), + Some(("token", token.to_string())), + Some(("channel", request.channel.to_string())), request .cursor .as_ref() @@ -152,15 +166,17 @@ where /// /// Wraps https://api.slack.com/methods/conversations.info -pub async fn info(client: &R, request: &InfoRequest) -> Result> +pub async fn info( + client: &R, + token: &str, + request: &InfoRequest, +) -> Result> where R: SlackWebRequestSender, { let params = vec![ - request - .channel - .as_ref() - .map(|channel| ("channel", channel.to_string())), + Some(("token", token.to_string())), + Some(("channel", request.channel.to_string())), request .include_locale .as_ref() @@ -187,6 +203,7 @@ where pub async fn invite( client: &R, + token: Option<&str>, request: &InviteRequest, ) -> Result> where @@ -205,7 +222,11 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/conversations.invite"); client - .post(&url, ¶ms[..], &[]) + .post( + &url, + ¶ms[..], + &token.map_or(vec![], |t| vec![("token", t.to_string())]), + ) .await .map_err(InviteError::Client) .and_then(|result| { @@ -217,7 +238,11 @@ where /// /// Wraps https://api.slack.com/methods/conversations.join -pub async fn join(client: &R, request: &JoinRequest) -> Result> +pub async fn join( + client: &R, + token: Option<&str>, + request: &JoinRequest, +) -> Result> where R: SlackWebRequestSender, { @@ -228,7 +253,11 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/conversations.join"); client - .post(&url, ¶ms[..], &[]) + .post( + &url, + ¶ms[..], + &token.map_or(vec![], |t| vec![("token", t.to_string())]), + ) .await .map_err(JoinError::Client) .and_then(|result| { @@ -240,7 +269,11 @@ where /// /// Wraps https://api.slack.com/methods/conversations.kick -pub async fn kick(client: &R, request: &KickRequest) -> Result> +pub async fn kick( + client: &R, + token: Option<&str>, + request: &KickRequest, +) -> Result> where R: SlackWebRequestSender, { @@ -254,7 +287,11 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/conversations.kick"); client - .post(&url, ¶ms[..], &[]) + .post( + &url, + ¶ms[..], + &token.map_or(vec![], |t| vec![("token", t.to_string())]), + ) .await .map_err(KickError::Client) .and_then(|result| { @@ -268,6 +305,7 @@ where pub async fn leave( client: &R, + token: Option<&str>, request: &LeaveRequest, ) -> Result> where @@ -280,7 +318,11 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/conversations.leave"); client - .post(&url, ¶ms[..], &[]) + .post( + &url, + ¶ms[..], + &token.map_or(vec![], |t| vec![("token", t.to_string())]), + ) .await .map_err(LeaveError::Client) .and_then(|result| { @@ -292,11 +334,16 @@ where /// /// Wraps https://api.slack.com/methods/conversations.list -pub async fn list(client: &R, request: &ListRequest) -> Result> +pub async fn list( + client: &R, + token: &str, + request: &ListRequest, +) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), request .cursor .as_ref() @@ -329,7 +376,11 @@ where /// /// Wraps https://api.slack.com/methods/conversations.mark -pub async fn mark(client: &R, request: &MarkRequest) -> Result> +pub async fn mark( + client: &R, + token: Option<&str>, + request: &MarkRequest, +) -> Result> where R: SlackWebRequestSender, { @@ -343,7 +394,11 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/conversations.mark"); client - .post(&url, ¶ms[..], &[]) + .post( + &url, + ¶ms[..], + &token.map_or(vec![], |t| vec![("token", t.to_string())]), + ) .await .map_err(MarkError::Client) .and_then(|result| { @@ -357,12 +412,14 @@ where pub async fn members( client: &R, + token: Option<&str>, request: &MembersRequest, ) -> Result> where R: SlackWebRequestSender, { let params = vec![ + token.map(|token| ("token", token.to_string())), request .channel .as_ref() @@ -391,7 +448,11 @@ where /// /// Wraps https://api.slack.com/methods/conversations.open -pub async fn open(client: &R, request: &OpenRequest) -> Result> +pub async fn open( + client: &R, + token: Option<&str>, + request: &OpenRequest, +) -> Result> where R: SlackWebRequestSender, { @@ -412,7 +473,11 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/conversations.open"); client - .post(&url, ¶ms[..], &[]) + .post( + &url, + ¶ms[..], + &token.map_or(vec![], |t| vec![("token", t.to_string())]), + ) .await .map_err(OpenError::Client) .and_then(|result| { @@ -426,6 +491,7 @@ where pub async fn rename( client: &R, + token: Option<&str>, request: &RenameRequest, ) -> Result> where @@ -441,7 +507,11 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/conversations.rename"); client - .post(&url, ¶ms[..], &[]) + .post( + &url, + ¶ms[..], + &token.map_or(vec![], |t| vec![("token", t.to_string())]), + ) .await .map_err(RenameError::Client) .and_then(|result| { @@ -455,12 +525,14 @@ where pub async fn replies( client: &R, + token: Option<&str>, request: &RepliesRequest, ) -> Result> where R: SlackWebRequestSender, { let params = vec![ + token.map(|token| ("token", token.to_string())), request .channel .as_ref() @@ -504,6 +576,7 @@ where pub async fn set_purpose( client: &R, + token: Option<&str>, request: &SetPurposeRequest, ) -> Result> where @@ -522,7 +595,11 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/conversations.setPurpose"); client - .post(&url, ¶ms[..], &[]) + .post( + &url, + ¶ms[..], + &token.map_or(vec![], |t| vec![("token", t.to_string())]), + ) .await .map_err(SetPurposeError::Client) .and_then(|result| { @@ -536,6 +613,7 @@ where pub async fn set_topic( client: &R, + token: Option<&str>, request: &SetTopicRequest, ) -> Result> where @@ -554,7 +632,11 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/conversations.setTopic"); client - .post(&url, ¶ms[..], &[]) + .post( + &url, + ¶ms[..], + &token.map_or(vec![], |t| vec![("token", t.to_string())]), + ) .await .map_err(SetTopicError::Client) .and_then(|result| { @@ -568,6 +650,7 @@ where pub async fn unarchive( client: &R, + token: Option<&str>, request: &UnarchiveRequest, ) -> Result> where @@ -580,7 +663,11 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/conversations.unarchive"); client - .post(&url, ¶ms[..], &[]) + .post( + &url, + ¶ms[..], + &token.map_or(vec![], |t| vec![("token", t.to_string())]), + ) .await .map_err(UnarchiveError::Client) .and_then(|result| { diff --git a/src/async_impl/mods/dialog.rs b/src/async_impl/mods/dialog.rs index 17c6a1f3..83667ad5 100644 --- a/src/async_impl/mods/dialog.rs +++ b/src/async_impl/mods/dialog.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use crate::async_impl::SlackWebRequestSender; pub use crate::mod_types::dialog_types::*; @@ -23,11 +23,16 @@ pub use crate::mod_types::dialog_types::*; /// /// Wraps https://api.slack.com/methods/dialog.open -pub async fn open(client: &R, request: &OpenRequest) -> Result> +pub async fn open( + client: &R, + token: &str, + request: &OpenRequest, +) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), Some(("dialog", request.dialog.to_string())), Some(("trigger_id", request.trigger_id.to_string())), ]; diff --git a/src/async_impl/mods/dnd.rs b/src/async_impl/mods/dnd.rs index 89f29bf7..fc215f14 100644 --- a/src/async_impl/mods/dnd.rs +++ b/src/async_impl/mods/dnd.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use crate::async_impl::SlackWebRequestSender; pub use crate::mod_types::dnd_types::*; @@ -25,7 +25,8 @@ pub use crate::mod_types::dnd_types::*; pub async fn end_dnd( client: &R, - request: &EndDndRequest, + token: &str, + _request: &EndDndRequest, ) -> Result> where R: SlackWebRequestSender, @@ -34,7 +35,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/dnd.endDnd"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(EndDndError::Client) .and_then(|result| { @@ -48,7 +49,8 @@ where pub async fn end_snooze( client: &R, - request: &EndSnoozeRequest, + token: &str, + _request: &EndSnoozeRequest, ) -> Result> where R: SlackWebRequestSender, @@ -57,7 +59,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/dnd.endSnooze"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(EndSnoozeError::Client) .and_then(|result| { @@ -69,11 +71,18 @@ where /// /// Wraps https://api.slack.com/methods/dnd.info -pub async fn info(client: &R, request: &InfoRequest) -> Result> +pub async fn info( + client: &R, + token: Option<&str>, + request: &InfoRequest, +) -> Result> where R: SlackWebRequestSender, { - let params = vec![request.user.as_ref().map(|user| ("user", user.to_string()))]; + let params = vec![ + token.map(|token| ("token", token.to_string())), + request.user.as_ref().map(|user| ("user", user.to_string())), + ]; let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/dnd.info"); client @@ -91,6 +100,7 @@ where pub async fn set_snooze( client: &R, + token: &str, request: &SetSnoozeRequest, ) -> Result> where @@ -100,7 +110,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/dnd.setSnooze"); client - .post(&url, ¶ms[..], &[("token", request.token.clone())]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(SetSnoozeError::Client) .and_then(|result| { @@ -114,15 +124,19 @@ where pub async fn team_info( client: &R, + token: Option<&str>, request: &TeamInfoRequest, ) -> Result> where R: SlackWebRequestSender, { - let params = vec![request - .users - .as_ref() - .map(|users| ("users", users.to_string()))]; + let params = vec![ + token.map(|token| ("token", token.to_string())), + request + .users + .as_ref() + .map(|users| ("users", users.to_string())), + ]; let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/dnd.teamInfo"); client diff --git a/src/async_impl/mods/emoji.rs b/src/async_impl/mods/emoji.rs index 9f97c946..72b69854 100644 --- a/src/async_impl/mods/emoji.rs +++ b/src/async_impl/mods/emoji.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use crate::async_impl::SlackWebRequestSender; pub use crate::mod_types::emoji_types::*; @@ -23,11 +23,15 @@ pub use crate::mod_types::emoji_types::*; /// /// Wraps https://api.slack.com/methods/emoji.list -pub async fn list(client: &R, request: &ListRequest) -> Result> +pub async fn list( + client: &R, + token: &str, + _request: &ListRequest, +) -> Result> where R: SlackWebRequestSender, { - let params = vec![]; + let params = vec![Some(("token", token.to_string()))]; let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/emoji.list"); client diff --git a/src/async_impl/mods/files/comments.rs b/src/async_impl/mods/files/comments.rs index f84a24d9..f48db547 100644 --- a/src/async_impl/mods/files/comments.rs +++ b/src/async_impl/mods/files/comments.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use crate::async_impl::SlackWebRequestSender; pub use crate::mod_types::files::comments_types::*; @@ -25,6 +25,7 @@ pub use crate::mod_types::files::comments_types::*; pub async fn delete( client: &R, + token: Option<&str>, request: &DeleteRequest, ) -> Result> where @@ -37,7 +38,11 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/files.comments.delete"); client - .post(&url, ¶ms[..], &[]) + .post( + &url, + ¶ms[..], + &token.map_or(vec![], |t| vec![("token", t.to_string())]), + ) .await .map_err(DeleteError::Client) .and_then(|result| { diff --git a/src/async_impl/mods/files/mod.rs b/src/async_impl/mods/files/mod.rs index d51cc663..454519f6 100644 --- a/src/async_impl/mods/files/mod.rs +++ b/src/async_impl/mods/files/mod.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub mod comments; pub mod remote; @@ -28,6 +28,7 @@ pub use crate::mod_types::files::*; pub async fn delete( client: &R, + token: Option<&str>, request: &DeleteRequest, ) -> Result> where @@ -37,7 +38,11 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/files.delete"); client - .post(&url, ¶ms[..], &[]) + .post( + &url, + ¶ms[..], + &token.map_or(vec![], |t| vec![("token", t.to_string())]), + ) .await .map_err(DeleteError::Client) .and_then(|result| { @@ -49,11 +54,16 @@ where /// /// Wraps https://api.slack.com/methods/files.info -pub async fn info(client: &R, request: &InfoRequest) -> Result> +pub async fn info( + client: &R, + token: Option<&str>, + request: &InfoRequest, +) -> Result> where R: SlackWebRequestSender, { let params = vec![ + token.map(|token| ("token", token.to_string())), request .count .as_ref() @@ -84,11 +94,16 @@ where /// /// Wraps https://api.slack.com/methods/files.list -pub async fn list(client: &R, request: &ListRequest) -> Result> +pub async fn list( + client: &R, + token: Option<&str>, + request: &ListRequest, +) -> Result> where R: SlackWebRequestSender, { let params = vec![ + token.map(|token| ("token", token.to_string())), request .channel .as_ref() @@ -138,6 +153,7 @@ where pub async fn revoke_public_url( client: &R, + token: Option<&str>, request: &RevokePublicURLRequest, ) -> Result> where @@ -147,7 +163,11 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/files.revokePublicURL"); client - .post(&url, ¶ms[..], &[]) + .post( + &url, + ¶ms[..], + &token.map_or(vec![], |t| vec![("token", t.to_string())]), + ) .await .map_err(RevokePublicURLError::Client) .and_then(|result| { @@ -161,6 +181,7 @@ where pub async fn shared_public_url( client: &R, + token: Option<&str>, request: &SharedPublicURLRequest, ) -> Result> where @@ -170,7 +191,11 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/files.sharedPublicURL"); client - .post(&url, ¶ms[..], &[]) + .post( + &url, + ¶ms[..], + &token.map_or(vec![], |t| vec![("token", t.to_string())]), + ) .await .map_err(SharedPublicURLError::Client) .and_then(|result| { @@ -184,6 +209,7 @@ where pub async fn upload( client: &R, + token: Option<&str>, request: &UploadRequest, ) -> Result> where @@ -226,10 +252,7 @@ where .post( &url, ¶ms[..], - &request - .token - .as_ref() - .map_or(vec![], |t| vec![("token", t.into())]), + &token.map_or(vec![], |t| vec![("token", t.to_string())]), ) .await .map_err(UploadError::Client) diff --git a/src/async_impl/mods/files/remote.rs b/src/async_impl/mods/files/remote.rs index d986e770..bc129994 100644 --- a/src/async_impl/mods/files/remote.rs +++ b/src/async_impl/mods/files/remote.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use crate::async_impl::SlackWebRequestSender; pub use crate::mod_types::files::remote_types::*; @@ -23,7 +23,11 @@ pub use crate::mod_types::files::remote_types::*; /// /// Wraps https://api.slack.com/methods/files.remote.add -pub async fn add(client: &R, request: &AddRequest) -> Result> +pub async fn add( + client: &R, + token: Option<&str>, + request: &AddRequest, +) -> Result> where R: SlackWebRequestSender, { @@ -64,10 +68,7 @@ where .post( &url, ¶ms[..], - &request - .token - .as_ref() - .map_or(vec![], |t| vec![("token", t.into())]), + &token.map_or(vec![], |t| vec![("token", t.to_string())]), ) .await .map_err(AddError::Client) @@ -80,11 +81,16 @@ where /// /// Wraps https://api.slack.com/methods/files.remote.info -pub async fn info(client: &R, request: &InfoRequest) -> Result> +pub async fn info( + client: &R, + token: Option<&str>, + request: &InfoRequest, +) -> Result> where R: SlackWebRequestSender, { let params = vec![ + token.map(|token| ("token", token.to_string())), request .external_id .as_ref() @@ -106,11 +112,16 @@ where /// /// Wraps https://api.slack.com/methods/files.remote.list -pub async fn list(client: &R, request: &ListRequest) -> Result> +pub async fn list( + client: &R, + token: Option<&str>, + request: &ListRequest, +) -> Result> where R: SlackWebRequestSender, { let params = vec![ + token.map(|token| ("token", token.to_string())), request .channel .as_ref() @@ -149,6 +160,7 @@ where pub async fn remove( client: &R, + token: Option<&str>, request: &RemoveRequest, ) -> Result> where @@ -167,10 +179,7 @@ where .post( &url, ¶ms[..], - &request - .token - .as_ref() - .map_or(vec![], |t| vec![("token", t.into())]), + &token.map_or(vec![], |t| vec![("token", t.to_string())]), ) .await .map_err(RemoveError::Client) @@ -185,12 +194,14 @@ where pub async fn share( client: &R, + token: Option<&str>, request: &ShareRequest, ) -> Result> where R: SlackWebRequestSender, { let params = vec![ + token.map(|token| ("token", token.to_string())), request .channels .as_ref() @@ -218,6 +229,7 @@ where pub async fn update( client: &R, + token: Option<&str>, request: &UpdateRequest, ) -> Result> where @@ -261,10 +273,7 @@ where .post( &url, ¶ms[..], - &request - .token - .as_ref() - .map_or(vec![], |t| vec![("token", t.into())]), + &token.map_or(vec![], |t| vec![("token", t.to_string())]), ) .await .map_err(UpdateError::Client) diff --git a/src/async_impl/mods/migration.rs b/src/async_impl/mods/migration.rs index e673d918..102c471b 100644 --- a/src/async_impl/mods/migration.rs +++ b/src/async_impl/mods/migration.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use crate::async_impl::SlackWebRequestSender; pub use crate::mod_types::migration_types::*; @@ -25,12 +25,14 @@ pub use crate::mod_types::migration_types::*; pub async fn exchange( client: &R, + token: &str, request: &ExchangeRequest, ) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), request .team_id .as_ref() diff --git a/src/async_impl/mods/oauth/mod.rs b/src/async_impl/mods/oauth/mod.rs index 17b0e52e..bba01a7c 100644 --- a/src/async_impl/mods/oauth/mod.rs +++ b/src/async_impl/mods/oauth/mod.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub mod v_2; diff --git a/src/async_impl/mods/oauth/v_2.rs b/src/async_impl/mods/oauth/v_2.rs index 0df9fd77..01c074df 100644 --- a/src/async_impl/mods/oauth/v_2.rs +++ b/src/async_impl/mods/oauth/v_2.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use crate::async_impl::SlackWebRequestSender; pub use crate::mod_types::oauth::v_2_types::*; diff --git a/src/async_impl/mods/pins.rs b/src/async_impl/mods/pins.rs index 0204a9aa..8c385479 100644 --- a/src/async_impl/mods/pins.rs +++ b/src/async_impl/mods/pins.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use crate::async_impl::SlackWebRequestSender; pub use crate::mod_types::pins_types::*; @@ -23,7 +23,11 @@ pub use crate::mod_types::pins_types::*; /// /// Wraps https://api.slack.com/methods/pins.add -pub async fn add(client: &R, request: &AddRequest) -> Result> +pub async fn add( + client: &R, + token: &str, + request: &AddRequest, +) -> Result> where R: SlackWebRequestSender, { @@ -37,7 +41,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/pins.add"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(AddError::Client) .and_then(|result| { @@ -49,11 +53,18 @@ where /// /// Wraps https://api.slack.com/methods/pins.list -pub async fn list(client: &R, request: &ListRequest) -> Result> +pub async fn list( + client: &R, + token: &str, + request: &ListRequest, +) -> Result> where R: SlackWebRequestSender, { - let params = vec![Some(("channel", request.channel.to_string()))]; + let params = vec![ + Some(("token", token.to_string())), + Some(("channel", request.channel.to_string())), + ]; let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/pins.list"); client @@ -71,6 +82,7 @@ where pub async fn remove( client: &R, + token: &str, request: &RemoveRequest, ) -> Result> where @@ -86,7 +98,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/pins.remove"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(RemoveError::Client) .and_then(|result| { diff --git a/src/async_impl/mods/reactions.rs b/src/async_impl/mods/reactions.rs index b683c103..6fe63dd9 100644 --- a/src/async_impl/mods/reactions.rs +++ b/src/async_impl/mods/reactions.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use crate::async_impl::SlackWebRequestSender; pub use crate::mod_types::reactions_types::*; @@ -23,7 +23,11 @@ pub use crate::mod_types::reactions_types::*; /// /// Wraps https://api.slack.com/methods/reactions.add -pub async fn add(client: &R, request: &AddRequest) -> Result> +pub async fn add( + client: &R, + token: &str, + request: &AddRequest, +) -> Result> where R: SlackWebRequestSender, { @@ -35,7 +39,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/reactions.add"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(AddError::Client) .and_then(|result| { @@ -47,11 +51,16 @@ where /// /// Wraps https://api.slack.com/methods/reactions.get -pub async fn get(client: &R, request: &GetRequest) -> Result> +pub async fn get( + client: &R, + token: &str, + request: &GetRequest, +) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), request .channel .as_ref() @@ -82,11 +91,16 @@ where /// /// Wraps https://api.slack.com/methods/reactions.list -pub async fn list(client: &R, request: &ListRequest) -> Result> +pub async fn list( + client: &R, + token: &str, + request: &ListRequest, +) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), request .count .as_ref() @@ -120,6 +134,7 @@ where pub async fn remove( client: &R, + token: &str, request: &RemoveRequest, ) -> Result> where @@ -144,7 +159,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/reactions.remove"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(RemoveError::Client) .and_then(|result| { diff --git a/src/async_impl/mods/reminders.rs b/src/async_impl/mods/reminders.rs index 69cd053e..0f92244b 100644 --- a/src/async_impl/mods/reminders.rs +++ b/src/async_impl/mods/reminders.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use crate::async_impl::SlackWebRequestSender; pub use crate::mod_types::reminders_types::*; @@ -23,7 +23,11 @@ pub use crate::mod_types::reminders_types::*; /// /// Wraps https://api.slack.com/methods/reminders.add -pub async fn add(client: &R, request: &AddRequest) -> Result> +pub async fn add( + client: &R, + token: &str, + request: &AddRequest, +) -> Result> where R: SlackWebRequestSender, { @@ -35,7 +39,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/reminders.add"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(AddError::Client) .and_then(|result| { @@ -49,6 +53,7 @@ where pub async fn complete( client: &R, + token: Option<&str>, request: &CompleteRequest, ) -> Result> where @@ -61,7 +66,11 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/reminders.complete"); client - .post(&url, ¶ms[..], &[]) + .post( + &url, + ¶ms[..], + &token.map_or(vec![], |t| vec![("token", t.to_string())]), + ) .await .map_err(CompleteError::Client) .and_then(|result| { @@ -75,6 +84,7 @@ where pub async fn delete( client: &R, + token: Option<&str>, request: &DeleteRequest, ) -> Result> where @@ -87,7 +97,11 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/reminders.delete"); client - .post(&url, ¶ms[..], &[]) + .post( + &url, + ¶ms[..], + &token.map_or(vec![], |t| vec![("token", t.to_string())]), + ) .await .map_err(DeleteError::Client) .and_then(|result| { @@ -99,14 +113,21 @@ where /// /// Wraps https://api.slack.com/methods/reminders.info -pub async fn info(client: &R, request: &InfoRequest) -> Result> +pub async fn info( + client: &R, + token: Option<&str>, + request: &InfoRequest, +) -> Result> where R: SlackWebRequestSender, { - let params = vec![request - .reminder - .as_ref() - .map(|reminder| ("reminder", reminder.to_string()))]; + let params = vec![ + token.map(|token| ("token", token.to_string())), + request + .reminder + .as_ref() + .map(|reminder| ("reminder", reminder.to_string())), + ]; let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/reminders.info"); client @@ -122,11 +143,15 @@ where /// /// Wraps https://api.slack.com/methods/reminders.list -pub async fn list(client: &R, request: &ListRequest) -> Result> +pub async fn list( + client: &R, + token: Option<&str>, + _request: &ListRequest, +) -> Result> where R: SlackWebRequestSender, { - let params = vec![]; + let params = vec![token.map(|token| ("token", token.to_string()))]; let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/reminders.list"); client diff --git a/src/async_impl/mods/rtm.rs b/src/async_impl/mods/rtm.rs index c1354909..fa5c4b79 100644 --- a/src/async_impl/mods/rtm.rs +++ b/src/async_impl/mods/rtm.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use crate::async_impl::SlackWebRequestSender; pub use crate::mod_types::rtm_types::*; @@ -25,12 +25,14 @@ pub use crate::mod_types::rtm_types::*; pub async fn connect( client: &R, + token: &str, request: &ConnectRequest, ) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), request .batch_presence_aware .as_ref() diff --git a/src/async_impl/mods/search.rs b/src/async_impl/mods/search.rs index 4ef0313e..5babc951 100644 --- a/src/async_impl/mods/search.rs +++ b/src/async_impl/mods/search.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use crate::async_impl::SlackWebRequestSender; pub use crate::mod_types::search_types::*; @@ -25,12 +25,14 @@ pub use crate::mod_types::search_types::*; pub async fn messages( client: &R, + token: &str, request: &MessagesRequest, ) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), request .count .as_ref() diff --git a/src/async_impl/mods/stars.rs b/src/async_impl/mods/stars.rs index 6e0eb370..b88f2f43 100644 --- a/src/async_impl/mods/stars.rs +++ b/src/async_impl/mods/stars.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use crate::async_impl::SlackWebRequestSender; pub use crate::mod_types::stars_types::*; @@ -23,7 +23,11 @@ pub use crate::mod_types::stars_types::*; /// /// Wraps https://api.slack.com/methods/stars.add -pub async fn add(client: &R, request: &AddRequest) -> Result> +pub async fn add( + client: &R, + token: &str, + request: &AddRequest, +) -> Result> where R: SlackWebRequestSender, { @@ -45,7 +49,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/stars.add"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(AddError::Client) .and_then(|result| { @@ -57,11 +61,16 @@ where /// /// Wraps https://api.slack.com/methods/stars.list -pub async fn list(client: &R, request: &ListRequest) -> Result> +pub async fn list( + client: &R, + token: Option<&str>, + request: &ListRequest, +) -> Result> where R: SlackWebRequestSender, { let params = vec![ + token.map(|token| ("token", token.to_string())), request .count .as_ref() @@ -93,6 +102,7 @@ where pub async fn remove( client: &R, + token: &str, request: &RemoveRequest, ) -> Result> where @@ -116,7 +126,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/stars.remove"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(RemoveError::Client) .and_then(|result| { diff --git a/src/async_impl/mods/team/mod.rs b/src/async_impl/mods/team/mod.rs index 5196f50e..ddac417e 100644 --- a/src/async_impl/mods/team/mod.rs +++ b/src/async_impl/mods/team/mod.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub mod profile; @@ -27,12 +27,14 @@ pub use crate::mod_types::team::*; pub async fn access_logs( client: &R, + token: &str, request: &AccessLogsRequest, ) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), request .before .as_ref() @@ -60,12 +62,16 @@ where pub async fn billable_info( client: &R, + token: &str, request: &BillableInfoRequest, ) -> Result> where R: SlackWebRequestSender, { - let params = vec![request.user.as_ref().map(|user| ("user", user.to_string()))]; + let params = vec![ + Some(("token", token.to_string())), + request.user.as_ref().map(|user| ("user", user.to_string())), + ]; let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/team.billableInfo"); client @@ -81,11 +87,18 @@ where /// /// Wraps https://api.slack.com/methods/team.info -pub async fn info(client: &R, request: &InfoRequest) -> Result> +pub async fn info( + client: &R, + token: &str, + request: &InfoRequest, +) -> Result> where R: SlackWebRequestSender, { - let params = vec![request.team.as_ref().map(|team| ("team", team.to_string()))]; + let params = vec![ + Some(("token", token.to_string())), + request.team.as_ref().map(|team| ("team", team.to_string())), + ]; let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/team.info"); client @@ -103,12 +116,14 @@ where pub async fn integration_logs( client: &R, + token: &str, request: &IntegrationLogsRequest, ) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), request .app_id .as_ref() diff --git a/src/async_impl/mods/team/profile.rs b/src/async_impl/mods/team/profile.rs index 0e022d1d..47cffd72 100644 --- a/src/async_impl/mods/team/profile.rs +++ b/src/async_impl/mods/team/profile.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use crate::async_impl::SlackWebRequestSender; pub use crate::mod_types::team::profile_types::*; @@ -23,14 +23,21 @@ pub use crate::mod_types::team::profile_types::*; /// /// Wraps https://api.slack.com/methods/team.profile.get -pub async fn get(client: &R, request: &GetRequest) -> Result> +pub async fn get( + client: &R, + token: &str, + request: &GetRequest, +) -> Result> where R: SlackWebRequestSender, { - let params = vec![request - .visibility - .as_ref() - .map(|visibility| ("visibility", visibility.to_string()))]; + let params = vec![ + Some(("token", token.to_string())), + request + .visibility + .as_ref() + .map(|visibility| ("visibility", visibility.to_string())), + ]; let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/team.profile.get"); client diff --git a/src/async_impl/mods/usergroups/mod.rs b/src/async_impl/mods/usergroups/mod.rs index 1af8f651..30c57e3d 100644 --- a/src/async_impl/mods/usergroups/mod.rs +++ b/src/async_impl/mods/usergroups/mod.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub mod users; @@ -27,6 +27,7 @@ pub use crate::mod_types::usergroups::*; pub async fn create( client: &R, + token: &str, request: &CreateRequest, ) -> Result> where @@ -54,7 +55,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/usergroups.create"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(CreateError::Client) .and_then(|result| { @@ -68,6 +69,7 @@ where pub async fn disable( client: &R, + token: &str, request: &DisableRequest, ) -> Result> where @@ -83,7 +85,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/usergroups.disable"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(DisableError::Client) .and_then(|result| { @@ -97,6 +99,7 @@ where pub async fn enable( client: &R, + token: &str, request: &EnableRequest, ) -> Result> where @@ -112,7 +115,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/usergroups.enable"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(EnableError::Client) .and_then(|result| { @@ -124,11 +127,16 @@ where /// /// Wraps https://api.slack.com/methods/usergroups.list -pub async fn list(client: &R, request: &ListRequest) -> Result> +pub async fn list( + client: &R, + token: &str, + request: &ListRequest, +) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), request .include_count .as_ref() @@ -159,6 +167,7 @@ where pub async fn update( client: &R, + token: &str, request: &UpdateRequest, ) -> Result> where @@ -187,7 +196,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/usergroups.update"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(UpdateError::Client) .and_then(|result| { diff --git a/src/async_impl/mods/usergroups/users.rs b/src/async_impl/mods/usergroups/users.rs index 4c81b4ff..5863e7e4 100644 --- a/src/async_impl/mods/usergroups/users.rs +++ b/src/async_impl/mods/usergroups/users.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use crate::async_impl::SlackWebRequestSender; pub use crate::mod_types::usergroups::users_types::*; @@ -23,11 +23,16 @@ pub use crate::mod_types::usergroups::users_types::*; /// /// Wraps https://api.slack.com/methods/usergroups.users.list -pub async fn list(client: &R, request: &ListRequest) -> Result> +pub async fn list( + client: &R, + token: &str, + request: &ListRequest, +) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), request .include_disabled .as_ref() @@ -51,6 +56,7 @@ where pub async fn update( client: &R, + token: &str, request: &UpdateRequest, ) -> Result> where @@ -67,7 +73,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/usergroups.users.update"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(UpdateError::Client) .and_then(|result| { diff --git a/src/async_impl/mods/users/mod.rs b/src/async_impl/mods/users/mod.rs index c1e56824..9e1ac64e 100644 --- a/src/async_impl/mods/users/mod.rs +++ b/src/async_impl/mods/users/mod.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub mod profile; @@ -27,12 +27,14 @@ pub use crate::mod_types::users::*; pub async fn conversations( client: &R, + token: Option<&str>, request: &ConversationsRequest, ) -> Result> where R: SlackWebRequestSender, { let params = vec![ + token.map(|token| ("token", token.to_string())), request .cursor .as_ref() @@ -68,7 +70,8 @@ where pub async fn delete_photo( client: &R, - request: &DeletePhotoRequest, + token: &str, + _request: &DeletePhotoRequest, ) -> Result> where R: SlackWebRequestSender, @@ -77,7 +80,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/users.deletePhoto"); client - .post(&url, ¶ms[..], &[("token", request.token.clone())]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(DeletePhotoError::Client) .and_then(|result| { @@ -91,12 +94,16 @@ where pub async fn get_presence( client: &R, + token: &str, request: &GetPresenceRequest, ) -> Result> where R: SlackWebRequestSender, { - let params = vec![request.user.as_ref().map(|user| ("user", user.to_string()))]; + let params = vec![ + Some(("token", token.to_string())), + request.user.as_ref().map(|user| ("user", user.to_string())), + ]; let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/users.getPresence"); client @@ -114,12 +121,13 @@ where pub async fn identity( client: &R, - request: &IdentityRequest, + token: Option<&str>, + _request: &IdentityRequest, ) -> Result> where R: SlackWebRequestSender, { - let params = vec![]; + let params = vec![token.map(|token| ("token", token.to_string()))]; let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/users.identity"); client @@ -135,11 +143,16 @@ where /// /// Wraps https://api.slack.com/methods/users.info -pub async fn info(client: &R, request: &InfoRequest) -> Result> +pub async fn info( + client: &R, + token: &str, + request: &InfoRequest, +) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), request .include_locale .as_ref() @@ -161,11 +174,16 @@ where /// /// Wraps https://api.slack.com/methods/users.list -pub async fn list(client: &R, request: &ListRequest) -> Result> +pub async fn list( + client: &R, + token: Option<&str>, + request: &ListRequest, +) -> Result> where R: SlackWebRequestSender, { let params = vec![ + token.map(|token| ("token", token.to_string())), request .cursor .as_ref() @@ -196,12 +214,16 @@ where pub async fn lookup_by_email( client: &R, + token: &str, request: &LookupByEmailRequest, ) -> Result> where R: SlackWebRequestSender, { - let params = vec![Some(("email", request.email.to_string()))]; + let params = vec![ + Some(("token", token.to_string())), + Some(("email", request.email.to_string())), + ]; let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/users.lookupByEmail"); client @@ -219,7 +241,8 @@ where pub async fn set_active( client: &R, - request: &SetActiveRequest, + token: &str, + _request: &SetActiveRequest, ) -> Result> where R: SlackWebRequestSender, @@ -228,7 +251,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/users.setActive"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(SetActiveError::Client) .and_then(|result| { @@ -242,6 +265,7 @@ where pub async fn set_photo( client: &R, + token: &str, request: &SetPhotoRequest, ) -> Result> where @@ -268,7 +292,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/users.setPhoto"); client - .post(&url, ¶ms[..], &[("token", request.token.clone())]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(SetPhotoError::Client) .and_then(|result| { @@ -282,6 +306,7 @@ where pub async fn set_presence( client: &R, + token: &str, request: &SetPresenceRequest, ) -> Result> where @@ -291,7 +316,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/users.setPresence"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(SetPresenceError::Client) .and_then(|result| { diff --git a/src/async_impl/mods/users/profile.rs b/src/async_impl/mods/users/profile.rs index 4cb6b077..8e004dd7 100644 --- a/src/async_impl/mods/users/profile.rs +++ b/src/async_impl/mods/users/profile.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use crate::async_impl::SlackWebRequestSender; pub use crate::mod_types::users::profile_types::*; @@ -23,11 +23,16 @@ pub use crate::mod_types::users::profile_types::*; /// /// Wraps https://api.slack.com/methods/users.profile.get -pub async fn get(client: &R, request: &GetRequest) -> Result> +pub async fn get( + client: &R, + token: &str, + request: &GetRequest, +) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), request .include_labels .as_ref() @@ -49,7 +54,11 @@ where /// /// Wraps https://api.slack.com/methods/users.profile.set -pub async fn set(client: &R, request: &SetRequest) -> Result> +pub async fn set( + client: &R, + token: &str, + request: &SetRequest, +) -> Result> where R: SlackWebRequestSender, { @@ -68,7 +77,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/users.profile.set"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .await .map_err(SetError::Client) .and_then(|result| { diff --git a/src/async_impl/mods/views.rs b/src/async_impl/mods/views.rs index 9a2dde6a..89bb7574 100644 --- a/src/async_impl/mods/views.rs +++ b/src/async_impl/mods/views.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use crate::async_impl::SlackWebRequestSender; pub use crate::mod_types::views_types::*; @@ -23,11 +23,16 @@ pub use crate::mod_types::views_types::*; /// /// Wraps https://api.slack.com/methods/views.open -pub async fn open(client: &R, request: &OpenRequest) -> Result> +pub async fn open( + client: &R, + token: &str, + request: &OpenRequest, +) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), Some(("trigger_id", request.trigger_id.to_string())), Some(("view", request.view.to_string())), ]; @@ -48,12 +53,14 @@ where pub async fn publish( client: &R, + token: &str, request: &PublishRequest, ) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), request.hash.as_ref().map(|hash| ("hash", hash.to_string())), Some(("user_id", request.user_id.to_string())), Some(("view", request.view.to_string())), @@ -73,11 +80,16 @@ where /// /// Wraps https://api.slack.com/methods/views.push -pub async fn push(client: &R, request: &PushRequest) -> Result> +pub async fn push( + client: &R, + token: &str, + request: &PushRequest, +) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), Some(("trigger_id", request.trigger_id.to_string())), Some(("view", request.view.to_string())), ]; @@ -98,12 +110,14 @@ where pub async fn update( client: &R, + token: &str, request: &UpdateRequest, ) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), request .external_id .as_ref() diff --git a/src/async_impl/mods/workflows.rs b/src/async_impl/mods/workflows.rs index 10b035fd..cb29b460 100644 --- a/src/async_impl/mods/workflows.rs +++ b/src/async_impl/mods/workflows.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use crate::async_impl::SlackWebRequestSender; pub use crate::mod_types::workflows_types::*; @@ -25,12 +25,14 @@ pub use crate::mod_types::workflows_types::*; pub async fn step_completed( client: &R, + token: &str, request: &StepCompletedRequest, ) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), request .outputs .as_ref() @@ -57,12 +59,14 @@ where pub async fn step_failed( client: &R, + token: &str, request: &StepFailedRequest, ) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), Some(("error", request.error.to_string())), Some(( "workflow_step_execute_id", @@ -86,12 +90,14 @@ where pub async fn update_step( client: &R, + token: &str, request: &UpdateStepRequest, ) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), request .inputs .as_ref() diff --git a/src/async_impl/requests.rs b/src/async_impl/requests.rs index f94d3d08..7abc4840 100644 --- a/src/async_impl/requests.rs +++ b/src/async_impl/requests.rs @@ -55,7 +55,7 @@ mod reqwest_support { /// # let token = "some_token"; /// let client = slack_api::requests::default_client().unwrap(); /// let params = Default::default(); - /// let response = slack_api::channels::list(&client, &token, ¶ms); + /// let response = slack_api::conversations::list(&client, &token, ¶ms); /// ``` pub fn default_client() -> Result { Ok(Client::new()) diff --git a/src/lib.rs b/src/lib.rs index a222a3e2..4d74fcd5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -90,7 +90,6 @@ where #[cfg(test)] mod tests { use super::UserProfile; - use serde_json; #[test] fn test_user_profile_fields_empty_array_deserialize() { diff --git a/src/mod_types/admin/apps/approved_types.rs b/src/mod_types/admin/apps/approved_types.rs index fa56ecec..b762f681 100644 --- a/src/mod_types/admin/apps/approved_types.rs +++ b/src/mod_types/admin/apps/approved_types.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use std::convert::From; use std::error::Error; diff --git a/src/mod_types/admin/apps/mod.rs b/src/mod_types/admin/apps/mod.rs index c9a5df67..a44d956b 100644 --- a/src/mod_types/admin/apps/mod.rs +++ b/src/mod_types/admin/apps/mod.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub mod approved_types; pub mod requests_types; diff --git a/src/mod_types/admin/apps/requests_types.rs b/src/mod_types/admin/apps/requests_types.rs index 6549afc5..bd254390 100644 --- a/src/mod_types/admin/apps/requests_types.rs +++ b/src/mod_types/admin/apps/requests_types.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use std::convert::From; use std::error::Error; diff --git a/src/mod_types/admin/apps/restricted_types.rs b/src/mod_types/admin/apps/restricted_types.rs index fa56ecec..b762f681 100644 --- a/src/mod_types/admin/apps/restricted_types.rs +++ b/src/mod_types/admin/apps/restricted_types.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use std::convert::From; use std::error::Error; diff --git a/src/mod_types/admin/conversations/ekm_types.rs b/src/mod_types/admin/conversations/ekm_types.rs index b2992697..6284e7bf 100644 --- a/src/mod_types/admin/conversations/ekm_types.rs +++ b/src/mod_types/admin/conversations/ekm_types.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use std::convert::From; use std::error::Error; diff --git a/src/mod_types/admin/conversations/mod.rs b/src/mod_types/admin/conversations/mod.rs index f57a3130..754ab229 100644 --- a/src/mod_types/admin/conversations/mod.rs +++ b/src/mod_types/admin/conversations/mod.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub mod ekm_types; pub mod restrict_access_types; @@ -1317,7 +1317,7 @@ pub struct SearchChannelsInner { pub num_members: Option, pub pending_shared: Option>, pub previous_names: Option>, - pub priority: Option, + pub priority: Option, pub purpose: SearchPurposeInner, pub topic: SearchTopicInner, pub unlinked: Option, diff --git a/src/mod_types/admin/conversations/restrict_access_types.rs b/src/mod_types/admin/conversations/restrict_access_types.rs index 9738356e..7120ceb1 100644 --- a/src/mod_types/admin/conversations/restrict_access_types.rs +++ b/src/mod_types/admin/conversations/restrict_access_types.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use std::convert::From; use std::error::Error; @@ -28,8 +28,6 @@ pub struct AddGroupRequest { pub group_id: String, /// The workspace where the channel exists. This argument is required for channels only tied to one workspace, and optional for channels that are shared across an organization. pub team_id: Option, - /// Authentication token. Requires scope: `admin.conversations:write` - pub token: String, } #[derive(Clone, Debug, Deserialize)] @@ -159,8 +157,6 @@ pub struct RemoveGroupRequest { pub group_id: String, /// The workspace where the channel exists. This argument is required for channels only tied to one workspace, and optional for channels that are shared across an organization. pub team_id: String, - /// Authentication token. Requires scope: `admin.conversations:write` - pub token: String, } #[derive(Clone, Debug, Deserialize)] diff --git a/src/mod_types/admin/emoji_types.rs b/src/mod_types/admin/emoji_types.rs index 3fb5fb05..1668de0e 100644 --- a/src/mod_types/admin/emoji_types.rs +++ b/src/mod_types/admin/emoji_types.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use std::convert::From; use std::error::Error; @@ -24,8 +24,6 @@ use std::fmt; pub struct AddRequest { /// The name of the emoji to be removed. Colons (`:myemoji:`) around the value are not required, although they may be included. pub name: String, - /// Authentication token. Requires scope: `admin.teams:write` - pub token: String, /// The URL of a file to use as an image for the emoji. Square images under 128KB and with transparent backgrounds work best. pub url: String, } @@ -92,8 +90,6 @@ pub struct AddAliasRequest { pub alias_for: String, /// The name of the emoji to be aliased. Colons (`:myemoji:`) around the value are not required, although they may be included. pub name: String, - /// Authentication token. Requires scope: `admin.teams:write` - pub token: String, } #[derive(Clone, Debug, Deserialize)] @@ -220,8 +216,6 @@ impl Error for ListError { pub struct RemoveRequest { /// The name of the emoji to be removed. Colons (`:myemoji:`) around the value are not required, although they may be included. pub name: String, - /// Authentication token. Requires scope: `admin.teams:write` - pub token: String, } #[derive(Clone, Debug, Deserialize)] @@ -286,8 +280,6 @@ pub struct RenameRequest { pub name: String, /// The new name of the emoji. pub new_name: String, - /// Authentication token. Requires scope: `admin.teams:write` - pub token: String, } #[derive(Clone, Debug, Deserialize)] diff --git a/src/mod_types/admin/invite_requests/approved_types.rs b/src/mod_types/admin/invite_requests/approved_types.rs index 3f352ef1..50e7926d 100644 --- a/src/mod_types/admin/invite_requests/approved_types.rs +++ b/src/mod_types/admin/invite_requests/approved_types.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use std::convert::From; use std::error::Error; diff --git a/src/mod_types/admin/invite_requests/denied_types.rs b/src/mod_types/admin/invite_requests/denied_types.rs index 66cc8c36..7cff5aa9 100644 --- a/src/mod_types/admin/invite_requests/denied_types.rs +++ b/src/mod_types/admin/invite_requests/denied_types.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use std::convert::From; use std::error::Error; diff --git a/src/mod_types/admin/invite_requests/mod.rs b/src/mod_types/admin/invite_requests/mod.rs index 39ed80c1..64a6200b 100644 --- a/src/mod_types/admin/invite_requests/mod.rs +++ b/src/mod_types/admin/invite_requests/mod.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub mod approved_types; pub mod denied_types; diff --git a/src/mod_types/admin/mod.rs b/src/mod_types/admin/mod.rs index a59a393e..d8f41467 100644 --- a/src/mod_types/admin/mod.rs +++ b/src/mod_types/admin/mod.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub mod apps; pub mod conversations; diff --git a/src/mod_types/admin/teams/admins_types.rs b/src/mod_types/admin/teams/admins_types.rs index 8da6d9cd..86d88240 100644 --- a/src/mod_types/admin/teams/admins_types.rs +++ b/src/mod_types/admin/teams/admins_types.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use std::convert::From; use std::error::Error; diff --git a/src/mod_types/admin/teams/mod.rs b/src/mod_types/admin/teams/mod.rs index 37b47651..aa255dec 100644 --- a/src/mod_types/admin/teams/mod.rs +++ b/src/mod_types/admin/teams/mod.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub mod admins_types; pub mod owners_types; diff --git a/src/mod_types/admin/teams/owners_types.rs b/src/mod_types/admin/teams/owners_types.rs index baa61f0e..e3c43a66 100644 --- a/src/mod_types/admin/teams/owners_types.rs +++ b/src/mod_types/admin/teams/owners_types.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use std::convert::From; use std::error::Error; diff --git a/src/mod_types/admin/teams/settings_types.rs b/src/mod_types/admin/teams/settings_types.rs index da28b9b4..e8670f91 100644 --- a/src/mod_types/admin/teams/settings_types.rs +++ b/src/mod_types/admin/teams/settings_types.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use std::convert::From; use std::error::Error; @@ -87,8 +87,6 @@ pub struct SetDefaultChannelsRequest { pub channel_ids: String, /// ID for the workspace to set the default channel for. pub team_id: String, - /// Authentication token. Requires scope: `admin.teams:write` - pub token: String, } #[derive(Clone, Debug, Deserialize)] @@ -287,8 +285,6 @@ pub struct SetIconRequest { pub image_url: String, /// ID for the workspace to set the icon for. pub team_id: String, - /// Authentication token. Requires scope: `admin.teams:write` - pub token: String, } #[derive(Clone, Debug, Deserialize)] diff --git a/src/mod_types/admin/usergroups_types.rs b/src/mod_types/admin/usergroups_types.rs index c28ef932..0f20d73e 100644 --- a/src/mod_types/admin/usergroups_types.rs +++ b/src/mod_types/admin/usergroups_types.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use std::convert::From; use std::error::Error; diff --git a/src/mod_types/admin/users/mod.rs b/src/mod_types/admin/users/mod.rs index 16e325bc..92fe4379 100644 --- a/src/mod_types/admin/users/mod.rs +++ b/src/mod_types/admin/users/mod.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub mod session_types; diff --git a/src/mod_types/admin/users/session_types.rs b/src/mod_types/admin/users/session_types.rs index c93f78c0..bfb75f80 100644 --- a/src/mod_types/admin/users/session_types.rs +++ b/src/mod_types/admin/users/session_types.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use std::convert::From; use std::error::Error; diff --git a/src/mod_types/api_types.rs b/src/mod_types/api_types.rs index 1eba068d..881685ed 100644 --- a/src/mod_types/api_types.rs +++ b/src/mod_types/api_types.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use std::convert::From; use std::error::Error; diff --git a/src/mod_types/apps/event/authorizations_types.rs b/src/mod_types/apps/event/authorizations_types.rs index 70f5cca7..8892ecc9 100644 --- a/src/mod_types/apps/event/authorizations_types.rs +++ b/src/mod_types/apps/event/authorizations_types.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use std::convert::From; use std::error::Error; diff --git a/src/mod_types/apps/event/mod.rs b/src/mod_types/apps/event/mod.rs index afc5869c..cd6ca167 100644 --- a/src/mod_types/apps/event/mod.rs +++ b/src/mod_types/apps/event/mod.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub mod authorizations_types; diff --git a/src/mod_types/apps/mod.rs b/src/mod_types/apps/mod.rs index 5eca3d5d..6711c59d 100644 --- a/src/mod_types/apps/mod.rs +++ b/src/mod_types/apps/mod.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub mod event; pub mod permissions; diff --git a/src/mod_types/apps/permissions/mod.rs b/src/mod_types/apps/permissions/mod.rs index 75cd23a0..8628c048 100644 --- a/src/mod_types/apps/permissions/mod.rs +++ b/src/mod_types/apps/permissions/mod.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub mod resources_types; pub mod scopes_types; diff --git a/src/mod_types/apps/permissions/resources_types.rs b/src/mod_types/apps/permissions/resources_types.rs index f01f463b..7d9a6823 100644 --- a/src/mod_types/apps/permissions/resources_types.rs +++ b/src/mod_types/apps/permissions/resources_types.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use std::convert::From; use std::error::Error; diff --git a/src/mod_types/apps/permissions/scopes_types.rs b/src/mod_types/apps/permissions/scopes_types.rs index ace8c3b3..d7133fea 100644 --- a/src/mod_types/apps/permissions/scopes_types.rs +++ b/src/mod_types/apps/permissions/scopes_types.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use std::convert::From; use std::error::Error; diff --git a/src/mod_types/apps/permissions/users_types.rs b/src/mod_types/apps/permissions/users_types.rs index 9e659f40..2cd6bb17 100644 --- a/src/mod_types/apps/permissions/users_types.rs +++ b/src/mod_types/apps/permissions/users_types.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use std::convert::From; use std::error::Error; diff --git a/src/mod_types/auth_types.rs b/src/mod_types/auth_types.rs index 2e5f6ef5..46733c65 100644 --- a/src/mod_types/auth_types.rs +++ b/src/mod_types/auth_types.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use std::convert::From; use std::error::Error; diff --git a/src/mod_types/bots_types.rs b/src/mod_types/bots_types.rs index eab0b1e6..baa29420 100644 --- a/src/mod_types/bots_types.rs +++ b/src/mod_types/bots_types.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use std::convert::From; use std::error::Error; diff --git a/src/mod_types/calls/mod.rs b/src/mod_types/calls/mod.rs index 21e753b7..d1c3f016 100644 --- a/src/mod_types/calls/mod.rs +++ b/src/mod_types/calls/mod.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub mod participants_types; diff --git a/src/mod_types/calls/participants_types.rs b/src/mod_types/calls/participants_types.rs index dc33b841..c4e34b69 100644 --- a/src/mod_types/calls/participants_types.rs +++ b/src/mod_types/calls/participants_types.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use std::convert::From; use std::error::Error; diff --git a/src/mod_types/chat/mod.rs b/src/mod_types/chat/mod.rs index 9e8ce656..5ff688fc 100644 --- a/src/mod_types/chat/mod.rs +++ b/src/mod_types/chat/mod.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub mod scheduled_messages_types; @@ -29,7 +29,7 @@ pub struct DeleteRequest { /// Channel containing the message to be deleted. pub channel: Option, /// Timestamp of the message to be deleted. - pub ts: Option, + pub ts: Option, } #[derive(Clone, Debug, Deserialize)] @@ -1297,7 +1297,7 @@ pub struct ScheduleMessageRequest { /// How this field works and whether it is required depends on other fields you use in your API call. [See below](#text_usage) for more detail. pub text: Option, /// Provide another message's `ts` value to make this message a reply. Avoid using a reply's `ts` value; use its parent instead. - pub thread_ts: Option, + pub thread_ts: Option, /// Pass true to enable unfurling of primarily text-based content. pub unfurl_links: Option, /// Pass false to disable unfurling of media content. diff --git a/src/mod_types/chat/scheduled_messages_types.rs b/src/mod_types/chat/scheduled_messages_types.rs index 2584207f..f469ba0d 100644 --- a/src/mod_types/chat/scheduled_messages_types.rs +++ b/src/mod_types/chat/scheduled_messages_types.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use std::convert::From; use std::error::Error; @@ -27,11 +27,11 @@ pub struct ListRequest { /// For pagination purposes, this is the `cursor` value returned from a previous call to `chat.scheduledmessages.list` indicating where you want to start this call from. pub cursor: Option, /// A UNIX timestamp of the latest value in the time range - pub latest: Option, + pub latest: Option, /// Maximum number of original entries to return. pub limit: Option, /// A UNIX timestamp of the oldest value in the time range - pub oldest: Option, + pub oldest: Option, } #[derive(Clone, Debug, Deserialize)] diff --git a/src/mod_types/conversations_types.rs b/src/mod_types/conversations_types.rs index 94a2142d..61a2dc81 100644 --- a/src/mod_types/conversations_types.rs +++ b/src/mod_types/conversations_types.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use std::convert::From; use std::error::Error; @@ -751,7 +751,7 @@ pub struct CreateChannelInner { pub pending_shared: Option>, pub pin_count: Option, pub previous_names: Option>, - pub priority: Option, + pub priority: Option, pub purpose: CreatePurposeInner, pub shared_team_ids: Option>, pub shares: Option>, @@ -919,23 +919,23 @@ impl Error for CreateError { #[derive(Clone, Default, Debug)] pub struct HistoryRequest { /// Conversation ID to fetch history for. - pub channel: Option, + pub channel: String, /// Paginate through collections of data by setting the `cursor` parameter to a `next_cursor` attribute returned by a previous request's `response_metadata`. Default value fetches the first "page" of the collection. See [pagination](/docs/pagination) for more detail. pub cursor: Option, /// Include messages with latest or oldest timestamp in results only when either timestamp is specified. pub inclusive: Option, /// End of time range of messages to include in results. - pub latest: Option, + pub latest: Option, /// The maximum number of items to return. Fewer than the requested number of items may be returned, even if the end of the users list hasn't been reached. pub limit: Option, /// Start of time range of messages to include in results. - pub oldest: Option, + pub oldest: Option, } #[derive(Clone, Debug, Deserialize)] pub struct HistoryAttachmentsInner { pub fallback: Option, - pub id: u64, + pub id: Option, pub image_bytes: Option, pub image_height: Option, pub image_url: Option, @@ -1193,7 +1193,7 @@ pub struct HistoryUserProfileInner { pub struct HistoryMessagesInner { pub attachments: Option>, pub blocks: Option>, - pub bot_id: Option>, + pub bot_id: Option, pub bot_profile: Option, pub client_msg_id: Option, pub comment: Option, @@ -1238,10 +1238,10 @@ pub struct HistoryMessagesInner { pub struct HistoryResponse { pub callstack: Option, pub channel_actions_count: u64, - pub channel_actions_ts: Vec, + pub channel_actions_ts: Option>, error: Option, pub has_more: bool, - pub messages: Vec, + pub messages: Option>, pub needed: Option, #[serde(default)] ok: bool, @@ -1351,7 +1351,7 @@ impl Error for HistoryError { #[derive(Clone, Default, Debug)] pub struct InfoRequest { /// Conversation ID to learn more about - pub channel: Option, + pub channel: String, /// Set this to `true` to receive the locale for this conversation. Defaults to `false` pub include_locale: Option, /// Set to `true` to include the member count for the specified conversation. Defaults to `false` @@ -1803,7 +1803,7 @@ pub struct InfoChannelInner { pub pending_shared: Option>, pub pin_count: Option, pub previous_names: Option>, - pub priority: Option, + pub priority: Option, pub purpose: InfoPurposeInner, pub shared_team_ids: Option>, pub shares: Option>, @@ -1820,7 +1820,7 @@ pub struct InfoChannelInner { #[derive(Clone, Debug, Deserialize)] pub struct InfoResponse { pub callstack: Option, - pub channel: Vec, + pub channel: InfoChannelInner, error: Option, pub needed: Option, #[serde(default)] @@ -2377,7 +2377,7 @@ pub struct InviteChannelInner { pub pending_shared: Option>, pub pin_count: Option, pub previous_names: Option>, - pub priority: Option, + pub priority: Option, pub purpose: InvitePurposeInner, pub shared_team_ids: Option>, pub shares: Option>, @@ -3012,7 +3012,7 @@ pub struct JoinChannelInner { pub pending_shared: Option>, pub pin_count: Option, pub previous_names: Option>, - pub priority: Option, + pub priority: Option, pub purpose: JoinPurposeInner, pub shared_team_ids: Option>, pub shares: Option>, @@ -3910,7 +3910,7 @@ pub struct ListChannelsInner { pub pending_shared: Option>, pub pin_count: Option, pub previous_names: Option>, - pub priority: Option, + pub priority: Option, pub purpose: ListPurposeInner, pub shared_team_ids: Option>, pub shares: Option>, @@ -3932,7 +3932,7 @@ pub struct ListResponseMetadataInner { #[derive(Clone, Debug, Deserialize)] pub struct ListResponse { pub callstack: Option, - pub channels: Vec>, + pub channels: Vec, error: Option, pub needed: Option, #[serde(default)] @@ -4036,7 +4036,7 @@ pub struct MarkRequest { /// Channel or conversation to set the read cursor for. pub channel: Option, /// Unique identifier of message you want marked as most recently seen in this conversation. - pub ts: Option, + pub ts: Option, } #[derive(Clone, Debug, Deserialize)] @@ -4743,7 +4743,7 @@ pub struct OpenChannelInner { pub pending_shared: Option>, pub pin_count: Option, pub previous_names: Option>, - pub priority: Option, + pub priority: Option, pub purpose: OpenPurposeInner, pub shared_team_ids: Option>, pub shares: Option>, @@ -5345,7 +5345,7 @@ pub struct RenameChannelInner { pub pending_shared: Option>, pub pin_count: Option, pub previous_names: Option>, - pub priority: Option, + pub priority: Option, pub purpose: RenamePurposeInner, pub shared_team_ids: Option>, pub shares: Option>, @@ -5515,13 +5515,13 @@ pub struct RepliesRequest { /// Include messages with latest or oldest timestamp in results only when either timestamp is specified. pub inclusive: Option, /// End of time range of messages to include in results. - pub latest: Option, + pub latest: Option, /// The maximum number of items to return. Fewer than the requested number of items may be returned, even if the end of the users list hasn't been reached. pub limit: Option, /// Start of time range of messages to include in results. - pub oldest: Option, + pub oldest: Option, /// Unique identifier of a thread's parent message. `ts` must be the timestamp of an existing message with 0 or more replies. If there are no replies then just the single message referenced by `ts` will return - it is just an ordinary, unthreaded message. - pub ts: Option, + pub ts: Option, } #[derive(Clone, Debug, Deserialize)] @@ -6123,7 +6123,7 @@ pub struct SetPurposeChannelInner { pub pending_shared: Option>, pub pin_count: Option, pub previous_names: Option>, - pub priority: Option, + pub priority: Option, pub purpose: SetPurposePurposeInner, pub shared_team_ids: Option>, pub shares: Option>, @@ -6729,7 +6729,7 @@ pub struct SetTopicChannelInner { pub pending_shared: Option>, pub pin_count: Option, pub previous_names: Option>, - pub priority: Option, + pub priority: Option, pub purpose: SetTopicPurposeInner, pub shared_team_ids: Option>, pub shares: Option>, diff --git a/src/mod_types/dialog_types.rs b/src/mod_types/dialog_types.rs index a9a96910..370ca16c 100644 --- a/src/mod_types/dialog_types.rs +++ b/src/mod_types/dialog_types.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use std::convert::From; use std::error::Error; diff --git a/src/mod_types/dnd_types.rs b/src/mod_types/dnd_types.rs index e86c3f43..fb427d40 100644 --- a/src/mod_types/dnd_types.rs +++ b/src/mod_types/dnd_types.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use std::convert::From; use std::error::Error; @@ -396,8 +396,6 @@ impl Error for InfoError { pub struct SetSnoozeRequest { /// Number of minutes, from now, to snooze until. pub num_minutes: String, - /// Authentication token. Requires scope: `dnd:write` - pub token: String, } #[derive(Clone, Debug, Deserialize)] diff --git a/src/mod_types/emoji_types.rs b/src/mod_types/emoji_types.rs index f31e4ef7..3a46523a 100644 --- a/src/mod_types/emoji_types.rs +++ b/src/mod_types/emoji_types.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use std::convert::From; use std::error::Error; diff --git a/src/mod_types/files/comments_types.rs b/src/mod_types/files/comments_types.rs index 619d9898..2d3efa0d 100644 --- a/src/mod_types/files/comments_types.rs +++ b/src/mod_types/files/comments_types.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use std::convert::From; use std::error::Error; diff --git a/src/mod_types/files/mod.rs b/src/mod_types/files/mod.rs index bc9c7fa2..b8e17dc9 100644 --- a/src/mod_types/files/mod.rs +++ b/src/mod_types/files/mod.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub mod comments_types; pub mod remote_types; @@ -380,9 +380,9 @@ pub struct ListRequest { /// Show truncated file info for files hidden due to being too old, and the team who owns the file being over the file limit. pub show_files_hidden_by_limit: Option, /// Filter files created after this timestamp (inclusive). - pub ts_from: Option, + pub ts_from: Option, /// Filter files created before this timestamp (inclusive). - pub ts_to: Option, + pub ts_to: Option, /// Filter files by type ([see below](#file_types)). You can pass multiple values in the types argument, like `types=spaces,snippets`.The default value is `all`, which does not filter the list. pub types: Option, /// Filter files created by a single user. @@ -1098,11 +1098,9 @@ pub struct UploadRequest { /// The message text introducing the file in specified `channels`. pub initial_comment: Option, /// Provide another message's `ts` value to upload this file as a reply. Never use a reply's `ts` value; use its parent instead. - pub thread_ts: Option, + pub thread_ts: Option, /// Title of file. pub title: Option, - /// Authentication token. Requires scope: `files:write:user` - pub token: Option, } #[derive(Clone, Debug, Deserialize)] @@ -1214,6 +1212,7 @@ impl Into>> for UploadResponse { #[derive(Debug)] pub enum UploadError { AccountInactive, + FileUploadSizeRestricted, FileUploadsDisabled, FileUploadsExceptImagesDisabled, InvalidArgName, @@ -1245,6 +1244,7 @@ impl<'a, E: Error> From<&'a str> for UploadError { fn from(s: &'a str) -> Self { match s { "account_inactive" => UploadError::AccountInactive, + "file_upload_size_restricted" => UploadError::FileUploadSizeRestricted, "file_uploads_disabled" => UploadError::FileUploadsDisabled, "file_uploads_except_images_disabled" => UploadError::FileUploadsExceptImagesDisabled, "invalid_arg_name" => UploadError::InvalidArgName, @@ -1273,6 +1273,9 @@ impl fmt::Display for UploadError { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match *self { UploadError::AccountInactive => write!(f, "Server returned error account_inactive"), + UploadError::FileUploadSizeRestricted => { + write!(f, "Server returned error file_upload_size_restricted") + } UploadError::FileUploadsDisabled => { write!(f, "Server returned error file_uploads_disabled") } diff --git a/src/mod_types/files/remote_types.rs b/src/mod_types/files/remote_types.rs index 175b90e1..f52a56ab 100644 --- a/src/mod_types/files/remote_types.rs +++ b/src/mod_types/files/remote_types.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use std::convert::From; use std::error::Error; @@ -34,8 +34,6 @@ pub struct AddRequest { pub preview_image: Option, /// Title of the file being shared. pub title: Option, - /// Authentication token. Requires scope: `remote_files:write` - pub token: Option, } #[derive(Clone, Debug, Deserialize)] @@ -167,9 +165,9 @@ pub struct ListRequest { /// The maximum number of items to return. pub limit: Option, /// Filter files created after this timestamp (inclusive). - pub ts_from: Option, + pub ts_from: Option, /// Filter files created before this timestamp (inclusive). - pub ts_to: Option, + pub ts_to: Option, } #[derive(Clone, Debug, Deserialize)] @@ -234,8 +232,6 @@ pub struct RemoveRequest { pub external_id: Option, /// Specify a file by providing its ID. pub file: Option, - /// Authentication token. Requires scope: `remote_files:write` - pub token: Option, } #[derive(Clone, Debug, Deserialize)] @@ -376,8 +372,6 @@ pub struct UpdateRequest { pub preview_image: Option, /// Title of the file being shared. pub title: Option, - /// Authentication token. Requires scope: `remote_files:write` - pub token: Option, } #[derive(Clone, Debug, Deserialize)] diff --git a/src/mod_types/migration_types.rs b/src/mod_types/migration_types.rs index 041b5826..dc1d049b 100644 --- a/src/mod_types/migration_types.rs +++ b/src/mod_types/migration_types.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use std::convert::From; use std::error::Error; diff --git a/src/mod_types/oauth/mod.rs b/src/mod_types/oauth/mod.rs index 8b1a546b..c414c8a7 100644 --- a/src/mod_types/oauth/mod.rs +++ b/src/mod_types/oauth/mod.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub mod v_2_types; diff --git a/src/mod_types/oauth/v_2_types.rs b/src/mod_types/oauth/v_2_types.rs index 59423320..61fbba06 100644 --- a/src/mod_types/oauth/v_2_types.rs +++ b/src/mod_types/oauth/v_2_types.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use std::convert::From; use std::error::Error; diff --git a/src/mod_types/pins_types.rs b/src/mod_types/pins_types.rs index 1c62d8cc..88866bdc 100644 --- a/src/mod_types/pins_types.rs +++ b/src/mod_types/pins_types.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use std::convert::From; use std::error::Error; diff --git a/src/mod_types/reactions_types.rs b/src/mod_types/reactions_types.rs index 6c4b57ba..5a5dd7ec 100644 --- a/src/mod_types/reactions_types.rs +++ b/src/mod_types/reactions_types.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use std::convert::From; use std::error::Error; diff --git a/src/mod_types/reminders_types.rs b/src/mod_types/reminders_types.rs index efa48740..f26788e1 100644 --- a/src/mod_types/reminders_types.rs +++ b/src/mod_types/reminders_types.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use std::convert::From; use std::error::Error; diff --git a/src/mod_types/rtm_types.rs b/src/mod_types/rtm_types.rs index 6f89f496..5d4c3e2c 100644 --- a/src/mod_types/rtm_types.rs +++ b/src/mod_types/rtm_types.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use std::convert::From; use std::error::Error; diff --git a/src/mod_types/search_types.rs b/src/mod_types/search_types.rs index 957bd9c6..83915223 100644 --- a/src/mod_types/search_types.rs +++ b/src/mod_types/search_types.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use std::convert::From; use std::error::Error; diff --git a/src/mod_types/stars_types.rs b/src/mod_types/stars_types.rs index 52ab2fcb..76758077 100644 --- a/src/mod_types/stars_types.rs +++ b/src/mod_types/stars_types.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use std::convert::From; use std::error::Error; diff --git a/src/mod_types/team/mod.rs b/src/mod_types/team/mod.rs index 780a2a64..f778a8d0 100644 --- a/src/mod_types/team/mod.rs +++ b/src/mod_types/team/mod.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub mod profile_types; diff --git a/src/mod_types/team/profile_types.rs b/src/mod_types/team/profile_types.rs index eecf9747..d86661ae 100644 --- a/src/mod_types/team/profile_types.rs +++ b/src/mod_types/team/profile_types.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use std::convert::From; use std::error::Error; @@ -42,7 +42,7 @@ pub struct GetFieldsInner { pub is_hidden: Option, pub label: String, pub options: Option>, - pub ordering: u64, + pub ordering: f64, pub possible_values: Option>, pub r#type: String, } diff --git a/src/mod_types/usergroups/mod.rs b/src/mod_types/usergroups/mod.rs index 3cf23a13..9b6aef79 100644 --- a/src/mod_types/usergroups/mod.rs +++ b/src/mod_types/usergroups/mod.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub mod users_types; diff --git a/src/mod_types/usergroups/users_types.rs b/src/mod_types/usergroups/users_types.rs index 3f876ff7..77ca4d8d 100644 --- a/src/mod_types/usergroups/users_types.rs +++ b/src/mod_types/usergroups/users_types.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use std::convert::From; use std::error::Error; diff --git a/src/mod_types/users/mod.rs b/src/mod_types/users/mod.rs index 1d6fe6f8..fb3fb2b7 100644 --- a/src/mod_types/users/mod.rs +++ b/src/mod_types/users/mod.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub mod profile_types; @@ -481,7 +481,7 @@ pub struct ConversationsChannelsInner { pub pending_shared: Option>, pub pin_count: Option, pub previous_names: Option>, - pub priority: Option, + pub priority: Option, pub purpose: ConversationsPurposeInner, pub shared_team_ids: Option>, pub shares: Option>, @@ -652,10 +652,7 @@ impl Error for ConversationsError { } #[derive(Clone, Default, Debug)] -pub struct DeletePhotoRequest { - /// Authentication token. Requires scope: `users.profile:write` - pub token: String, -} +pub struct DeletePhotoRequest {} #[derive(Clone, Debug, Deserialize)] pub struct DeletePhotoResponse { @@ -1071,7 +1068,7 @@ pub struct InfoFieldsInner { pub is_hidden: Option, pub label: String, pub options: Option>, - pub ordering: u64, + pub ordering: f64, pub possible_values: Option>, pub r#type: String, } @@ -1110,8 +1107,8 @@ pub struct InfoUserInner { pub two_factor_type: Option, pub tz: Option>, pub tz_label: Option, - pub tz_offset: Option, - pub updated: u64, + pub tz_offset: Option, + pub updated: f64, } #[derive(Clone, Debug, Deserialize)] @@ -1303,7 +1300,7 @@ pub struct ListFieldsInner { pub is_hidden: Option, pub label: String, pub options: Option>, - pub ordering: u64, + pub ordering: f64, pub possible_values: Option>, pub r#type: String, } @@ -1342,8 +1339,8 @@ pub struct ListMembersInner { pub two_factor_type: Option, pub tz: Option>, pub tz_label: Option, - pub tz_offset: Option, - pub updated: u64, + pub tz_offset: Option, + pub updated: f64, } #[derive(Clone, Debug, Deserialize)] @@ -1544,7 +1541,7 @@ pub struct LookupByEmailFieldsInner { pub is_hidden: Option, pub label: String, pub options: Option>, - pub ordering: u64, + pub ordering: f64, pub possible_values: Option>, pub r#type: String, } @@ -1583,8 +1580,8 @@ pub struct LookupByEmailUserInner { pub two_factor_type: Option, pub tz: Option>, pub tz_label: Option, - pub tz_offset: Option, - pub updated: u64, + pub tz_offset: Option, + pub updated: f64, } #[derive(Clone, Debug, Deserialize)] @@ -1849,8 +1846,6 @@ pub struct SetPhotoRequest { pub crop_y: Option, /// File contents via `multipart/form-data`. pub image: Option, - /// Authentication token. Requires scope: `users.profile:write` - pub token: String, } #[derive(Clone, Debug, Deserialize)] diff --git a/src/mod_types/users/profile_types.rs b/src/mod_types/users/profile_types.rs index 8522bd4e..141e1ec1 100644 --- a/src/mod_types/users/profile_types.rs +++ b/src/mod_types/users/profile_types.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use std::convert::From; use std::error::Error; diff --git a/src/mod_types/views_types.rs b/src/mod_types/views_types.rs index fcc2edb4..c769ad50 100644 --- a/src/mod_types/views_types.rs +++ b/src/mod_types/views_types.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use std::convert::From; use std::error::Error; diff --git a/src/mod_types/workflows_types.rs b/src/mod_types/workflows_types.rs index ded37bbc..c95224fc 100644 --- a/src/mod_types/workflows_types.rs +++ b/src/mod_types/workflows_types.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] use std::convert::From; use std::error::Error; diff --git a/src/sync/mods/admin/apps/approved.rs b/src/sync/mods/admin/apps/approved.rs index 52d64a02..8ccb2b9e 100644 --- a/src/sync/mods/admin/apps/approved.rs +++ b/src/sync/mods/admin/apps/approved.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub use crate::mod_types::admin::apps::approved_types::*; use crate::sync::SlackWebRequestSender; @@ -23,11 +23,16 @@ use crate::sync::SlackWebRequestSender; /// /// Wraps https://api.slack.com/methods/admin.apps.approved.list -pub fn list(client: &R, request: &ListRequest) -> Result> +pub fn list( + client: &R, + token: &str, + request: &ListRequest, +) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), request .cursor .as_ref() diff --git a/src/sync/mods/admin/apps/mod.rs b/src/sync/mods/admin/apps/mod.rs index 2e0248aa..b2aa842d 100644 --- a/src/sync/mods/admin/apps/mod.rs +++ b/src/sync/mods/admin/apps/mod.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub mod approved; pub mod requests; @@ -29,6 +29,7 @@ use crate::sync::SlackWebRequestSender; pub fn approve( client: &R, + token: &str, request: &ApproveRequest, ) -> Result> where @@ -51,7 +52,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.apps.approve"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(ApproveError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -64,6 +65,7 @@ where pub fn restrict( client: &R, + token: &str, request: &RestrictRequest, ) -> Result> where @@ -86,7 +88,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.apps.restrict"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(RestrictError::Client) .and_then(|result| { serde_json::from_str::(&result) diff --git a/src/sync/mods/admin/apps/requests.rs b/src/sync/mods/admin/apps/requests.rs index 32b367c9..28c5990c 100644 --- a/src/sync/mods/admin/apps/requests.rs +++ b/src/sync/mods/admin/apps/requests.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub use crate::mod_types::admin::apps::requests_types::*; use crate::sync::SlackWebRequestSender; @@ -23,11 +23,16 @@ use crate::sync::SlackWebRequestSender; /// /// Wraps https://api.slack.com/methods/admin.apps.requests.list -pub fn list(client: &R, request: &ListRequest) -> Result> +pub fn list( + client: &R, + token: &str, + request: &ListRequest, +) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), request .cursor .as_ref() diff --git a/src/sync/mods/admin/apps/restricted.rs b/src/sync/mods/admin/apps/restricted.rs index a453939d..06e63037 100644 --- a/src/sync/mods/admin/apps/restricted.rs +++ b/src/sync/mods/admin/apps/restricted.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub use crate::mod_types::admin::apps::restricted_types::*; use crate::sync::SlackWebRequestSender; @@ -23,11 +23,16 @@ use crate::sync::SlackWebRequestSender; /// /// Wraps https://api.slack.com/methods/admin.apps.restricted.list -pub fn list(client: &R, request: &ListRequest) -> Result> +pub fn list( + client: &R, + token: &str, + request: &ListRequest, +) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), request .cursor .as_ref() diff --git a/src/sync/mods/admin/conversations/ekm.rs b/src/sync/mods/admin/conversations/ekm.rs index e983cbcd..24334547 100644 --- a/src/sync/mods/admin/conversations/ekm.rs +++ b/src/sync/mods/admin/conversations/ekm.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub use crate::mod_types::admin::conversations::ekm_types::*; use crate::sync::SlackWebRequestSender; @@ -25,12 +25,14 @@ use crate::sync::SlackWebRequestSender; pub fn list_original_connected_channel_info( client: &R, + token: &str, request: &ListOriginalConnectedChannelInfoRequest, ) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), request .channel_ids .as_ref() diff --git a/src/sync/mods/admin/conversations/mod.rs b/src/sync/mods/admin/conversations/mod.rs index ed68dc8e..0d726561 100644 --- a/src/sync/mods/admin/conversations/mod.rs +++ b/src/sync/mods/admin/conversations/mod.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub mod ekm; pub mod restrict_access; @@ -28,6 +28,7 @@ use crate::sync::SlackWebRequestSender; pub fn archive( client: &R, + token: &str, request: &ArchiveRequest, ) -> Result> where @@ -37,7 +38,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.conversations.archive"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(ArchiveError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -50,6 +51,7 @@ where pub fn convert_to_private( client: &R, + token: &str, request: &ConvertToPrivateRequest, ) -> Result> where @@ -59,7 +61,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.conversations.convertToPrivate"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(ConvertToPrivateError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -72,6 +74,7 @@ where pub fn create( client: &R, + token: &str, request: &CreateRequest, ) -> Result> where @@ -96,7 +99,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.conversations.create"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(CreateError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -109,6 +112,7 @@ where pub fn delete( client: &R, + token: &str, request: &DeleteRequest, ) -> Result> where @@ -118,7 +122,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.conversations.delete"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(DeleteError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -131,6 +135,7 @@ where pub fn disconnect_shared( client: &R, + token: &str, request: &DisconnectSharedRequest, ) -> Result> where @@ -146,7 +151,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.conversations.disconnectShared"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(DisconnectSharedError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -159,12 +164,16 @@ where pub fn get_conversation_prefs( client: &R, + token: &str, request: &GetConversationPrefsRequest, ) -> Result> where R: SlackWebRequestSender, { - let params = vec![Some(("channel_id", request.channel_id.to_string()))]; + let params = vec![ + Some(("token", token.to_string())), + Some(("channel_id", request.channel_id.to_string())), + ]; let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.conversations.getConversationPrefs"); client @@ -181,12 +190,14 @@ where pub fn get_teams( client: &R, + token: &str, request: &GetTeamsRequest, ) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), Some(("channel_id", request.channel_id.to_string())), request .cursor @@ -213,6 +224,7 @@ where pub fn invite( client: &R, + token: &str, request: &InviteRequest, ) -> Result> where @@ -225,7 +237,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.conversations.invite"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(InviteError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -238,6 +250,7 @@ where pub fn rename( client: &R, + token: &str, request: &RenameRequest, ) -> Result> where @@ -250,7 +263,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.conversations.rename"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(RenameError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -263,12 +276,14 @@ where pub fn search( client: &R, + token: &str, request: &SearchRequest, ) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), request .cursor .as_ref() @@ -311,6 +326,7 @@ where pub fn set_conversation_prefs( client: &R, + token: &str, request: &SetConversationPrefsRequest, ) -> Result> where @@ -323,7 +339,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.conversations.setConversationPrefs"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(SetConversationPrefsError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -336,6 +352,7 @@ where pub fn set_teams( client: &R, + token: &str, request: &SetTeamsRequest, ) -> Result> where @@ -359,7 +376,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.conversations.setTeams"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(SetTeamsError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -372,6 +389,7 @@ where pub fn unarchive( client: &R, + token: &str, request: &UnarchiveRequest, ) -> Result> where @@ -381,7 +399,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.conversations.unarchive"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(UnarchiveError::Client) .and_then(|result| { serde_json::from_str::(&result) diff --git a/src/sync/mods/admin/conversations/restrict_access.rs b/src/sync/mods/admin/conversations/restrict_access.rs index cb7a63a5..17279195 100644 --- a/src/sync/mods/admin/conversations/restrict_access.rs +++ b/src/sync/mods/admin/conversations/restrict_access.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub use crate::mod_types::admin::conversations::restrict_access_types::*; use crate::sync::SlackWebRequestSender; @@ -25,6 +25,7 @@ use crate::sync::SlackWebRequestSender; pub fn add_group( client: &R, + token: &str, request: &AddGroupRequest, ) -> Result> where @@ -41,7 +42,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.conversations.restrictAccess.addGroup"); client - .post(&url, ¶ms[..], &[("token", request.token.clone())]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(AddGroupError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -54,12 +55,14 @@ where pub fn list_groups( client: &R, + token: &str, request: &ListGroupsRequest, ) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), Some(("channel_id", request.channel_id.to_string())), request .team_id @@ -82,6 +85,7 @@ where pub fn remove_group( client: &R, + token: &str, request: &RemoveGroupRequest, ) -> Result> where @@ -95,7 +99,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.conversations.restrictAccess.removeGroup"); client - .post(&url, ¶ms[..], &[("token", request.token.clone())]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(RemoveGroupError::Client) .and_then(|result| { serde_json::from_str::(&result) diff --git a/src/sync/mods/admin/emoji.rs b/src/sync/mods/admin/emoji.rs index 234309d3..269943f5 100644 --- a/src/sync/mods/admin/emoji.rs +++ b/src/sync/mods/admin/emoji.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub use crate::mod_types::admin::emoji_types::*; use crate::sync::SlackWebRequestSender; @@ -23,7 +23,11 @@ use crate::sync::SlackWebRequestSender; /// /// Wraps https://api.slack.com/methods/admin.emoji.add -pub fn add(client: &R, request: &AddRequest) -> Result> +pub fn add( + client: &R, + token: &str, + request: &AddRequest, +) -> Result> where R: SlackWebRequestSender, { @@ -34,7 +38,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.emoji.add"); client - .post(&url, ¶ms[..], &[("token", request.token.clone())]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(AddError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -47,6 +51,7 @@ where pub fn add_alias( client: &R, + token: &str, request: &AddAliasRequest, ) -> Result> where @@ -59,7 +64,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.emoji.addAlias"); client - .post(&url, ¶ms[..], &[("token", request.token.clone())]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(AddAliasError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -70,11 +75,16 @@ where /// /// Wraps https://api.slack.com/methods/admin.emoji.list -pub fn list(client: &R, request: &ListRequest) -> Result> +pub fn list( + client: &R, + token: &str, + request: &ListRequest, +) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), request .cursor .as_ref() @@ -100,6 +110,7 @@ where pub fn remove( client: &R, + token: &str, request: &RemoveRequest, ) -> Result> where @@ -109,7 +120,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.emoji.remove"); client - .post(&url, ¶ms[..], &[("token", request.token.clone())]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(RemoveError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -122,6 +133,7 @@ where pub fn rename( client: &R, + token: &str, request: &RenameRequest, ) -> Result> where @@ -134,7 +146,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.emoji.rename"); client - .post(&url, ¶ms[..], &[("token", request.token.clone())]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(RenameError::Client) .and_then(|result| { serde_json::from_str::(&result) diff --git a/src/sync/mods/admin/invite_requests/approved.rs b/src/sync/mods/admin/invite_requests/approved.rs index da8c63b6..af9c3050 100644 --- a/src/sync/mods/admin/invite_requests/approved.rs +++ b/src/sync/mods/admin/invite_requests/approved.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub use crate::mod_types::admin::invite_requests::approved_types::*; use crate::sync::SlackWebRequestSender; @@ -23,11 +23,16 @@ use crate::sync::SlackWebRequestSender; /// /// Wraps https://api.slack.com/methods/admin.inviteRequests.approved.list -pub fn list(client: &R, request: &ListRequest) -> Result> +pub fn list( + client: &R, + token: &str, + request: &ListRequest, +) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), request .cursor .as_ref() diff --git a/src/sync/mods/admin/invite_requests/denied.rs b/src/sync/mods/admin/invite_requests/denied.rs index f91976b5..e49b4c34 100644 --- a/src/sync/mods/admin/invite_requests/denied.rs +++ b/src/sync/mods/admin/invite_requests/denied.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub use crate::mod_types::admin::invite_requests::denied_types::*; use crate::sync::SlackWebRequestSender; @@ -23,11 +23,16 @@ use crate::sync::SlackWebRequestSender; /// /// Wraps https://api.slack.com/methods/admin.inviteRequests.denied.list -pub fn list(client: &R, request: &ListRequest) -> Result> +pub fn list( + client: &R, + token: &str, + request: &ListRequest, +) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), request .cursor .as_ref() diff --git a/src/sync/mods/admin/invite_requests/mod.rs b/src/sync/mods/admin/invite_requests/mod.rs index a1563ef3..22f05dac 100644 --- a/src/sync/mods/admin/invite_requests/mod.rs +++ b/src/sync/mods/admin/invite_requests/mod.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub mod approved; pub mod denied; @@ -28,6 +28,7 @@ use crate::sync::SlackWebRequestSender; pub fn approve( client: &R, + token: &str, request: &ApproveRequest, ) -> Result> where @@ -43,7 +44,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.inviteRequests.approve"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(ApproveError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -54,7 +55,11 @@ where /// /// Wraps https://api.slack.com/methods/admin.inviteRequests.deny -pub fn deny(client: &R, request: &DenyRequest) -> Result> +pub fn deny( + client: &R, + token: &str, + request: &DenyRequest, +) -> Result> where R: SlackWebRequestSender, { @@ -68,7 +73,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.inviteRequests.deny"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(DenyError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -79,11 +84,16 @@ where /// /// Wraps https://api.slack.com/methods/admin.inviteRequests.list -pub fn list(client: &R, request: &ListRequest) -> Result> +pub fn list( + client: &R, + token: &str, + request: &ListRequest, +) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), request .cursor .as_ref() diff --git a/src/sync/mods/admin/mod.rs b/src/sync/mods/admin/mod.rs index b3981802..3ffa6184 100644 --- a/src/sync/mods/admin/mod.rs +++ b/src/sync/mods/admin/mod.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub mod apps; pub mod conversations; diff --git a/src/sync/mods/admin/teams/admins.rs b/src/sync/mods/admin/teams/admins.rs index 49e98297..eec92899 100644 --- a/src/sync/mods/admin/teams/admins.rs +++ b/src/sync/mods/admin/teams/admins.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub use crate::mod_types::admin::teams::admins_types::*; use crate::sync::SlackWebRequestSender; @@ -23,11 +23,16 @@ use crate::sync::SlackWebRequestSender; /// /// Wraps https://api.slack.com/methods/admin.teams.admins.list -pub fn list(client: &R, request: &ListRequest) -> Result> +pub fn list( + client: &R, + token: &str, + request: &ListRequest, +) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), request .cursor .as_ref() diff --git a/src/sync/mods/admin/teams/mod.rs b/src/sync/mods/admin/teams/mod.rs index 3c58cb0b..b5e0ea5d 100644 --- a/src/sync/mods/admin/teams/mod.rs +++ b/src/sync/mods/admin/teams/mod.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub mod admins; pub mod owners; @@ -29,6 +29,7 @@ use crate::sync::SlackWebRequestSender; pub fn create( client: &R, + token: &str, request: &CreateRequest, ) -> Result> where @@ -49,7 +50,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.teams.create"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(CreateError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -60,11 +61,16 @@ where /// /// Wraps https://api.slack.com/methods/admin.teams.list -pub fn list(client: &R, request: &ListRequest) -> Result> +pub fn list( + client: &R, + token: &str, + request: &ListRequest, +) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), request .cursor .as_ref() diff --git a/src/sync/mods/admin/teams/owners.rs b/src/sync/mods/admin/teams/owners.rs index 6434b3d2..dfbf4447 100644 --- a/src/sync/mods/admin/teams/owners.rs +++ b/src/sync/mods/admin/teams/owners.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub use crate::mod_types::admin::teams::owners_types::*; use crate::sync::SlackWebRequestSender; @@ -23,11 +23,16 @@ use crate::sync::SlackWebRequestSender; /// /// Wraps https://api.slack.com/methods/admin.teams.owners.list -pub fn list(client: &R, request: &ListRequest) -> Result> +pub fn list( + client: &R, + token: &str, + request: &ListRequest, +) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), request .cursor .as_ref() diff --git a/src/sync/mods/admin/teams/settings.rs b/src/sync/mods/admin/teams/settings.rs index 1cf5d4b7..5d6167b4 100644 --- a/src/sync/mods/admin/teams/settings.rs +++ b/src/sync/mods/admin/teams/settings.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub use crate::mod_types::admin::teams::settings_types::*; use crate::sync::SlackWebRequestSender; @@ -23,11 +23,18 @@ use crate::sync::SlackWebRequestSender; /// /// Wraps https://api.slack.com/methods/admin.teams.settings.info -pub fn info(client: &R, request: &InfoRequest) -> Result> +pub fn info( + client: &R, + token: &str, + request: &InfoRequest, +) -> Result> where R: SlackWebRequestSender, { - let params = vec![Some(("team_id", request.team_id.to_string()))]; + let params = vec![ + Some(("token", token.to_string())), + Some(("team_id", request.team_id.to_string())), + ]; let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.teams.settings.info"); client @@ -44,6 +51,7 @@ where pub fn set_default_channels( client: &R, + token: &str, request: &SetDefaultChannelsRequest, ) -> Result> where @@ -56,7 +64,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.teams.settings.setDefaultChannels"); client - .post(&url, ¶ms[..], &[("token", request.token.clone())]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(SetDefaultChannelsError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -69,6 +77,7 @@ where pub fn set_description( client: &R, + token: &str, request: &SetDescriptionRequest, ) -> Result> where @@ -81,7 +90,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.teams.settings.setDescription"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(SetDescriptionError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -94,6 +103,7 @@ where pub fn set_discoverability( client: &R, + token: &str, request: &SetDiscoverabilityRequest, ) -> Result> where @@ -106,7 +116,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.teams.settings.setDiscoverability"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(SetDiscoverabilityError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -119,6 +129,7 @@ where pub fn set_icon( client: &R, + token: &str, request: &SetIconRequest, ) -> Result> where @@ -131,7 +142,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.teams.settings.setIcon"); client - .post(&url, ¶ms[..], &[("token", request.token.clone())]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(SetIconError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -144,6 +155,7 @@ where pub fn set_name( client: &R, + token: &str, request: &SetNameRequest, ) -> Result> where @@ -156,7 +168,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.teams.settings.setName"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(SetNameError::Client) .and_then(|result| { serde_json::from_str::(&result) diff --git a/src/sync/mods/admin/usergroups.rs b/src/sync/mods/admin/usergroups.rs index 327f31c0..fc77decc 100644 --- a/src/sync/mods/admin/usergroups.rs +++ b/src/sync/mods/admin/usergroups.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub use crate::mod_types::admin::usergroups_types::*; use crate::sync::SlackWebRequestSender; @@ -25,6 +25,7 @@ use crate::sync::SlackWebRequestSender; pub fn add_channels( client: &R, + token: &str, request: &AddChannelsRequest, ) -> Result> where @@ -41,7 +42,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.usergroups.addChannels"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(AddChannelsError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -54,6 +55,7 @@ where pub fn add_teams( client: &R, + token: &str, request: &AddTeamsRequest, ) -> Result> where @@ -70,7 +72,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.usergroups.addTeams"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(AddTeamsError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -83,12 +85,14 @@ where pub fn list_channels( client: &R, + token: &str, request: &ListChannelsRequest, ) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), request .include_num_members .as_ref() @@ -115,6 +119,7 @@ where pub fn remove_channels( client: &R, + token: &str, request: &RemoveChannelsRequest, ) -> Result> where @@ -127,7 +132,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.usergroups.removeChannels"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(RemoveChannelsError::Client) .and_then(|result| { serde_json::from_str::(&result) diff --git a/src/sync/mods/admin/users/mod.rs b/src/sync/mods/admin/users/mod.rs index 80b790e2..221d1bd1 100644 --- a/src/sync/mods/admin/users/mod.rs +++ b/src/sync/mods/admin/users/mod.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub mod session; @@ -27,6 +27,7 @@ use crate::sync::SlackWebRequestSender; pub fn assign( client: &R, + token: &str, request: &AssignRequest, ) -> Result> where @@ -51,7 +52,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.users.assign"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(AssignError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -64,6 +65,7 @@ where pub fn invite( client: &R, + token: &str, request: &InviteRequest, ) -> Result> where @@ -101,7 +103,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.users.invite"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(InviteError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -112,11 +114,16 @@ where /// /// Wraps https://api.slack.com/methods/admin.users.list -pub fn list(client: &R, request: &ListRequest) -> Result> +pub fn list( + client: &R, + token: &str, + request: &ListRequest, +) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), request .cursor .as_ref() @@ -143,6 +150,7 @@ where pub fn remove( client: &R, + token: &str, request: &RemoveRequest, ) -> Result> where @@ -155,7 +163,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.users.remove"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(RemoveError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -168,6 +176,7 @@ where pub fn set_admin( client: &R, + token: &str, request: &SetAdminRequest, ) -> Result> where @@ -180,7 +189,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.users.setAdmin"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(SetAdminError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -193,6 +202,7 @@ where pub fn set_expiration( client: &R, + token: &str, request: &SetExpirationRequest, ) -> Result> where @@ -206,7 +216,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.users.setExpiration"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(SetExpirationError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -219,6 +229,7 @@ where pub fn set_owner( client: &R, + token: &str, request: &SetOwnerRequest, ) -> Result> where @@ -231,7 +242,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.users.setOwner"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(SetOwnerError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -244,6 +255,7 @@ where pub fn set_regular( client: &R, + token: &str, request: &SetRegularRequest, ) -> Result> where @@ -256,7 +268,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.users.setRegular"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(SetRegularError::Client) .and_then(|result| { serde_json::from_str::(&result) diff --git a/src/sync/mods/admin/users/session.rs b/src/sync/mods/admin/users/session.rs index 1eca2259..f1bded7f 100644 --- a/src/sync/mods/admin/users/session.rs +++ b/src/sync/mods/admin/users/session.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub use crate::mod_types::admin::users::session_types::*; use crate::sync::SlackWebRequestSender; @@ -25,6 +25,7 @@ use crate::sync::SlackWebRequestSender; pub fn invalidate( client: &R, + token: &str, request: &InvalidateRequest, ) -> Result> where @@ -37,7 +38,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.users.session.invalidate"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(InvalidateError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -48,7 +49,11 @@ where /// /// Wraps https://api.slack.com/methods/admin.users.session.reset -pub fn reset(client: &R, request: &ResetRequest) -> Result> +pub fn reset( + client: &R, + token: &str, + request: &ResetRequest, +) -> Result> where R: SlackWebRequestSender, { @@ -66,7 +71,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/admin.users.session.reset"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(ResetError::Client) .and_then(|result| { serde_json::from_str::(&result) diff --git a/src/sync/mods/api.rs b/src/sync/mods/api.rs index b7946169..683f0798 100644 --- a/src/sync/mods/api.rs +++ b/src/sync/mods/api.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub use crate::mod_types::api_types::*; use crate::sync::SlackWebRequestSender; diff --git a/src/sync/mods/apps/event/authorizations.rs b/src/sync/mods/apps/event/authorizations.rs index 65e97087..8306c83d 100644 --- a/src/sync/mods/apps/event/authorizations.rs +++ b/src/sync/mods/apps/event/authorizations.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub use crate::mod_types::apps::event::authorizations_types::*; use crate::sync::SlackWebRequestSender; @@ -23,11 +23,16 @@ use crate::sync::SlackWebRequestSender; /// /// Wraps https://api.slack.com/methods/apps.event.authorizations.list -pub fn list(client: &R, request: &ListRequest) -> Result> +pub fn list( + client: &R, + token: &str, + request: &ListRequest, +) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), request .cursor .as_ref() diff --git a/src/sync/mods/apps/event/mod.rs b/src/sync/mods/apps/event/mod.rs index 53e353b9..3f161293 100644 --- a/src/sync/mods/apps/event/mod.rs +++ b/src/sync/mods/apps/event/mod.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub mod authorizations; diff --git a/src/sync/mods/apps/mod.rs b/src/sync/mods/apps/mod.rs index 5e00274d..5fa9d677 100644 --- a/src/sync/mods/apps/mod.rs +++ b/src/sync/mods/apps/mod.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub mod event; pub mod permissions; @@ -28,12 +28,14 @@ use crate::sync::SlackWebRequestSender; pub fn uninstall( client: &R, + token: Option<&str>, request: &UninstallRequest, ) -> Result> where R: SlackWebRequestSender, { let params = vec![ + token.map(|token| ("token", token.to_string())), request .client_id .as_ref() diff --git a/src/sync/mods/apps/permissions/mod.rs b/src/sync/mods/apps/permissions/mod.rs index 90f35e3b..4620bd73 100644 --- a/src/sync/mods/apps/permissions/mod.rs +++ b/src/sync/mods/apps/permissions/mod.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub mod resources; pub mod scopes; @@ -27,11 +27,15 @@ use crate::sync::SlackWebRequestSender; /// /// Wraps https://api.slack.com/methods/apps.permissions.info -pub fn info(client: &R, request: &InfoRequest) -> Result> +pub fn info( + client: &R, + token: Option<&str>, + _request: &InfoRequest, +) -> Result> where R: SlackWebRequestSender, { - let params = vec![]; + let params = vec![token.map(|token| ("token", token.to_string()))]; let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/apps.permissions.info"); client @@ -48,12 +52,14 @@ where pub fn request( client: &R, + token: &str, request: &RequestRequest, ) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), Some(("scopes", request.scopes.to_string())), Some(("trigger_id", request.trigger_id.to_string())), ]; diff --git a/src/sync/mods/apps/permissions/resources.rs b/src/sync/mods/apps/permissions/resources.rs index f8772ba3..ad5f0b39 100644 --- a/src/sync/mods/apps/permissions/resources.rs +++ b/src/sync/mods/apps/permissions/resources.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub use crate::mod_types::apps::permissions::resources_types::*; use crate::sync::SlackWebRequestSender; @@ -23,11 +23,16 @@ use crate::sync::SlackWebRequestSender; /// /// Wraps https://api.slack.com/methods/apps.permissions.resources.list -pub fn list(client: &R, request: &ListRequest) -> Result> +pub fn list( + client: &R, + token: &str, + request: &ListRequest, +) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), request .cursor .as_ref() diff --git a/src/sync/mods/apps/permissions/scopes.rs b/src/sync/mods/apps/permissions/scopes.rs index 6abe276b..48c9921e 100644 --- a/src/sync/mods/apps/permissions/scopes.rs +++ b/src/sync/mods/apps/permissions/scopes.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub use crate::mod_types::apps::permissions::scopes_types::*; use crate::sync::SlackWebRequestSender; @@ -23,11 +23,15 @@ use crate::sync::SlackWebRequestSender; /// /// Wraps https://api.slack.com/methods/apps.permissions.scopes.list -pub fn list(client: &R, request: &ListRequest) -> Result> +pub fn list( + client: &R, + token: &str, + _request: &ListRequest, +) -> Result> where R: SlackWebRequestSender, { - let params = vec![]; + let params = vec![Some(("token", token.to_string()))]; let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/apps.permissions.scopes.list"); client diff --git a/src/sync/mods/apps/permissions/users.rs b/src/sync/mods/apps/permissions/users.rs index 65166508..71491035 100644 --- a/src/sync/mods/apps/permissions/users.rs +++ b/src/sync/mods/apps/permissions/users.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub use crate::mod_types::apps::permissions::users_types::*; use crate::sync::SlackWebRequestSender; @@ -23,11 +23,16 @@ use crate::sync::SlackWebRequestSender; /// /// Wraps https://api.slack.com/methods/apps.permissions.users.list -pub fn list(client: &R, request: &ListRequest) -> Result> +pub fn list( + client: &R, + token: &str, + request: &ListRequest, +) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), request .cursor .as_ref() @@ -53,12 +58,14 @@ where pub fn request( client: &R, + token: &str, request: &RequestRequest, ) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), Some(("scopes", request.scopes.to_string())), Some(("trigger_id", request.trigger_id.to_string())), Some(("user", request.user.to_string())), diff --git a/src/sync/mods/auth.rs b/src/sync/mods/auth.rs index fd77c29e..7917b688 100644 --- a/src/sync/mods/auth.rs +++ b/src/sync/mods/auth.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub use crate::mod_types::auth_types::*; use crate::sync::SlackWebRequestSender; @@ -25,12 +25,16 @@ use crate::sync::SlackWebRequestSender; pub fn revoke( client: &R, + token: &str, request: &RevokeRequest, ) -> Result> where R: SlackWebRequestSender, { - let params = vec![request.test.as_ref().map(|test| ("test", test.to_string()))]; + let params = vec![ + Some(("token", token.to_string())), + request.test.as_ref().map(|test| ("test", test.to_string())), + ]; let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/auth.revoke"); client @@ -45,11 +49,15 @@ where /// /// Wraps https://api.slack.com/methods/auth.test -pub fn test(client: &R, request: &TestRequest) -> Result> +pub fn test( + client: &R, + token: &str, + _request: &TestRequest, +) -> Result> where R: SlackWebRequestSender, { - let params = vec![]; + let params = vec![Some(("token", token.to_string()))]; let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/auth.test"); client diff --git a/src/sync/mods/bots.rs b/src/sync/mods/bots.rs index 820939c3..69b176d4 100644 --- a/src/sync/mods/bots.rs +++ b/src/sync/mods/bots.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub use crate::mod_types::bots_types::*; use crate::sync::SlackWebRequestSender; @@ -23,11 +23,18 @@ use crate::sync::SlackWebRequestSender; /// /// Wraps https://api.slack.com/methods/bots.info -pub fn info(client: &R, request: &InfoRequest) -> Result> +pub fn info( + client: &R, + token: &str, + request: &InfoRequest, +) -> Result> where R: SlackWebRequestSender, { - let params = vec![request.bot.as_ref().map(|bot| ("bot", bot.to_string()))]; + let params = vec![ + Some(("token", token.to_string())), + request.bot.as_ref().map(|bot| ("bot", bot.to_string())), + ]; let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/bots.info"); client diff --git a/src/sync/mods/calls/mod.rs b/src/sync/mods/calls/mod.rs index 56d46c33..53aa94b1 100644 --- a/src/sync/mods/calls/mod.rs +++ b/src/sync/mods/calls/mod.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub mod participants; @@ -25,7 +25,11 @@ use crate::sync::SlackWebRequestSender; /// /// Wraps https://api.slack.com/methods/calls.add -pub fn add(client: &R, request: &AddRequest) -> Result> +pub fn add( + client: &R, + token: &str, + request: &AddRequest, +) -> Result> where R: SlackWebRequestSender, { @@ -60,7 +64,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/calls.add"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(AddError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -71,7 +75,11 @@ where /// /// Wraps https://api.slack.com/methods/calls.end -pub fn end(client: &R, request: &EndRequest) -> Result> +pub fn end( + client: &R, + token: &str, + request: &EndRequest, +) -> Result> where R: SlackWebRequestSender, { @@ -85,7 +93,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/calls.end"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(EndError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -96,11 +104,18 @@ where /// /// Wraps https://api.slack.com/methods/calls.info -pub fn info(client: &R, request: &InfoRequest) -> Result> +pub fn info( + client: &R, + token: &str, + request: &InfoRequest, +) -> Result> where R: SlackWebRequestSender, { - let params = vec![Some(("id", request.id.to_string()))]; + let params = vec![ + Some(("token", token.to_string())), + Some(("id", request.id.to_string())), + ]; let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/calls.info"); client @@ -117,6 +132,7 @@ where pub fn update( client: &R, + token: &str, request: &UpdateRequest, ) -> Result> where @@ -140,7 +156,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/calls.update"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(UpdateError::Client) .and_then(|result| { serde_json::from_str::(&result) diff --git a/src/sync/mods/calls/participants.rs b/src/sync/mods/calls/participants.rs index e37be19f..88b146cb 100644 --- a/src/sync/mods/calls/participants.rs +++ b/src/sync/mods/calls/participants.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub use crate::mod_types::calls::participants_types::*; use crate::sync::SlackWebRequestSender; @@ -23,7 +23,11 @@ use crate::sync::SlackWebRequestSender; /// /// Wraps https://api.slack.com/methods/calls.participants.add -pub fn add(client: &R, request: &AddRequest) -> Result> +pub fn add( + client: &R, + token: &str, + request: &AddRequest, +) -> Result> where R: SlackWebRequestSender, { @@ -34,7 +38,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/calls.participants.add"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(AddError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -47,6 +51,7 @@ where pub fn remove( client: &R, + token: &str, request: &RemoveRequest, ) -> Result> where @@ -59,7 +64,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/calls.participants.remove"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(RemoveError::Client) .and_then(|result| { serde_json::from_str::(&result) diff --git a/src/sync/mods/chat/mod.rs b/src/sync/mods/chat/mod.rs index d981728f..1a6627db 100644 --- a/src/sync/mods/chat/mod.rs +++ b/src/sync/mods/chat/mod.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub mod scheduled_messages; @@ -27,6 +27,7 @@ use crate::sync::SlackWebRequestSender; pub fn delete( client: &R, + token: Option<&str>, request: &DeleteRequest, ) -> Result> where @@ -46,7 +47,11 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/chat.delete"); client - .post(&url, ¶ms[..], &[]) + .post( + &url, + ¶ms[..], + &token.map_or(vec![], |t| vec![("token", t.to_string())]), + ) .map_err(DeleteError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -59,6 +64,7 @@ where pub fn delete_scheduled_message( client: &R, + token: &str, request: &DeleteScheduledMessageRequest, ) -> Result> where @@ -78,7 +84,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/chat.deleteScheduledMessage"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(DeleteScheduledMessageError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -91,12 +97,14 @@ where pub fn get_permalink( client: &R, + token: &str, request: &GetPermalinkRequest, ) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), Some(("channel", request.channel.to_string())), Some(("message_ts", request.message_ts.to_string())), ]; @@ -116,6 +124,7 @@ where pub fn me_message( client: &R, + token: Option<&str>, request: &MeMessageRequest, ) -> Result> where @@ -131,7 +140,11 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/chat.meMessage"); client - .post(&url, ¶ms[..], &[]) + .post( + &url, + ¶ms[..], + &token.map_or(vec![], |t| vec![("token", t.to_string())]), + ) .map_err(MeMessageError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -144,6 +157,7 @@ where pub fn post_ephemeral( client: &R, + token: &str, request: &PostEphemeralRequest, ) -> Result> where @@ -193,7 +207,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/chat.postEphemeral"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(PostEphemeralError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -206,6 +220,7 @@ where pub fn post_message( client: &R, + token: &str, request: &PostMessageRequest, ) -> Result> where @@ -270,7 +285,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/chat.postMessage"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(PostMessageError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -283,6 +298,7 @@ where pub fn schedule_message( client: &R, + token: Option<&str>, request: &ScheduleMessageRequest, ) -> Result> where @@ -338,7 +354,11 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/chat.scheduleMessage"); client - .post(&url, ¶ms[..], &[]) + .post( + &url, + ¶ms[..], + &token.map_or(vec![], |t| vec![("token", t.to_string())]), + ) .map_err(ScheduleMessageError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -351,6 +371,7 @@ where pub fn unfurl( client: &R, + token: &str, request: &UnfurlRequest, ) -> Result> where @@ -379,7 +400,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/chat.unfurl"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(UnfurlError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -392,6 +413,7 @@ where pub fn update( client: &R, + token: &str, request: &UpdateRequest, ) -> Result> where @@ -425,7 +447,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/chat.update"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(UpdateError::Client) .and_then(|result| { serde_json::from_str::(&result) diff --git a/src/sync/mods/chat/scheduled_messages.rs b/src/sync/mods/chat/scheduled_messages.rs index 3d986dc6..d7f70659 100644 --- a/src/sync/mods/chat/scheduled_messages.rs +++ b/src/sync/mods/chat/scheduled_messages.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub use crate::mod_types::chat::scheduled_messages_types::*; use crate::sync::SlackWebRequestSender; @@ -23,11 +23,16 @@ use crate::sync::SlackWebRequestSender; /// /// Wraps https://api.slack.com/methods/chat.scheduledMessages.list -pub fn list(client: &R, request: &ListRequest) -> Result> +pub fn list( + client: &R, + token: Option<&str>, + request: &ListRequest, +) -> Result> where R: SlackWebRequestSender, { let params = vec![ + token.map(|token| ("token", token.to_string())), request .channel .as_ref() diff --git a/src/sync/mods/conversations.rs b/src/sync/mods/conversations.rs index 500861a7..cff5f1ab 100644 --- a/src/sync/mods/conversations.rs +++ b/src/sync/mods/conversations.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub use crate::mod_types::conversations_types::*; use crate::sync::SlackWebRequestSender; @@ -25,6 +25,7 @@ use crate::sync::SlackWebRequestSender; pub fn archive( client: &R, + token: Option<&str>, request: &ArchiveRequest, ) -> Result> where @@ -37,7 +38,11 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/conversations.archive"); client - .post(&url, ¶ms[..], &[]) + .post( + &url, + ¶ms[..], + &token.map_or(vec![], |t| vec![("token", t.to_string())]), + ) .map_err(ArchiveError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -48,7 +53,11 @@ where /// /// Wraps https://api.slack.com/methods/conversations.close -pub fn close(client: &R, request: &CloseRequest) -> Result> +pub fn close( + client: &R, + token: Option<&str>, + request: &CloseRequest, +) -> Result> where R: SlackWebRequestSender, { @@ -59,7 +68,11 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/conversations.close"); client - .post(&url, ¶ms[..], &[]) + .post( + &url, + ¶ms[..], + &token.map_or(vec![], |t| vec![("token", t.to_string())]), + ) .map_err(CloseError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -72,6 +85,7 @@ where pub fn create( client: &R, + token: Option<&str>, request: &CreateRequest, ) -> Result> where @@ -87,7 +101,11 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/conversations.create"); client - .post(&url, ¶ms[..], &[]) + .post( + &url, + ¶ms[..], + &token.map_or(vec![], |t| vec![("token", t.to_string())]), + ) .map_err(CreateError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -100,16 +118,15 @@ where pub fn history( client: &R, + token: &str, request: &HistoryRequest, ) -> Result> where R: SlackWebRequestSender, { let params = vec![ - request - .channel - .as_ref() - .map(|channel| ("channel", channel.to_string())), + Some(("token", token.to_string())), + Some(("channel", request.channel.to_string())), request .cursor .as_ref() @@ -145,15 +162,17 @@ where /// /// Wraps https://api.slack.com/methods/conversations.info -pub fn info(client: &R, request: &InfoRequest) -> Result> +pub fn info( + client: &R, + token: &str, + request: &InfoRequest, +) -> Result> where R: SlackWebRequestSender, { let params = vec![ - request - .channel - .as_ref() - .map(|channel| ("channel", channel.to_string())), + Some(("token", token.to_string())), + Some(("channel", request.channel.to_string())), request .include_locale .as_ref() @@ -179,6 +198,7 @@ where pub fn invite( client: &R, + token: Option<&str>, request: &InviteRequest, ) -> Result> where @@ -197,7 +217,11 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/conversations.invite"); client - .post(&url, ¶ms[..], &[]) + .post( + &url, + ¶ms[..], + &token.map_or(vec![], |t| vec![("token", t.to_string())]), + ) .map_err(InviteError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -208,7 +232,11 @@ where /// /// Wraps https://api.slack.com/methods/conversations.join -pub fn join(client: &R, request: &JoinRequest) -> Result> +pub fn join( + client: &R, + token: Option<&str>, + request: &JoinRequest, +) -> Result> where R: SlackWebRequestSender, { @@ -219,7 +247,11 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/conversations.join"); client - .post(&url, ¶ms[..], &[]) + .post( + &url, + ¶ms[..], + &token.map_or(vec![], |t| vec![("token", t.to_string())]), + ) .map_err(JoinError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -230,7 +262,11 @@ where /// /// Wraps https://api.slack.com/methods/conversations.kick -pub fn kick(client: &R, request: &KickRequest) -> Result> +pub fn kick( + client: &R, + token: Option<&str>, + request: &KickRequest, +) -> Result> where R: SlackWebRequestSender, { @@ -244,7 +280,11 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/conversations.kick"); client - .post(&url, ¶ms[..], &[]) + .post( + &url, + ¶ms[..], + &token.map_or(vec![], |t| vec![("token", t.to_string())]), + ) .map_err(KickError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -255,7 +295,11 @@ where /// /// Wraps https://api.slack.com/methods/conversations.leave -pub fn leave(client: &R, request: &LeaveRequest) -> Result> +pub fn leave( + client: &R, + token: Option<&str>, + request: &LeaveRequest, +) -> Result> where R: SlackWebRequestSender, { @@ -266,7 +310,11 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/conversations.leave"); client - .post(&url, ¶ms[..], &[]) + .post( + &url, + ¶ms[..], + &token.map_or(vec![], |t| vec![("token", t.to_string())]), + ) .map_err(LeaveError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -277,11 +325,16 @@ where /// /// Wraps https://api.slack.com/methods/conversations.list -pub fn list(client: &R, request: &ListRequest) -> Result> +pub fn list( + client: &R, + token: &str, + request: &ListRequest, +) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), request .cursor .as_ref() @@ -313,7 +366,11 @@ where /// /// Wraps https://api.slack.com/methods/conversations.mark -pub fn mark(client: &R, request: &MarkRequest) -> Result> +pub fn mark( + client: &R, + token: Option<&str>, + request: &MarkRequest, +) -> Result> where R: SlackWebRequestSender, { @@ -327,7 +384,11 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/conversations.mark"); client - .post(&url, ¶ms[..], &[]) + .post( + &url, + ¶ms[..], + &token.map_or(vec![], |t| vec![("token", t.to_string())]), + ) .map_err(MarkError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -340,12 +401,14 @@ where pub fn members( client: &R, + token: Option<&str>, request: &MembersRequest, ) -> Result> where R: SlackWebRequestSender, { let params = vec![ + token.map(|token| ("token", token.to_string())), request .channel .as_ref() @@ -373,7 +436,11 @@ where /// /// Wraps https://api.slack.com/methods/conversations.open -pub fn open(client: &R, request: &OpenRequest) -> Result> +pub fn open( + client: &R, + token: Option<&str>, + request: &OpenRequest, +) -> Result> where R: SlackWebRequestSender, { @@ -394,7 +461,11 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/conversations.open"); client - .post(&url, ¶ms[..], &[]) + .post( + &url, + ¶ms[..], + &token.map_or(vec![], |t| vec![("token", t.to_string())]), + ) .map_err(OpenError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -407,6 +478,7 @@ where pub fn rename( client: &R, + token: Option<&str>, request: &RenameRequest, ) -> Result> where @@ -422,7 +494,11 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/conversations.rename"); client - .post(&url, ¶ms[..], &[]) + .post( + &url, + ¶ms[..], + &token.map_or(vec![], |t| vec![("token", t.to_string())]), + ) .map_err(RenameError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -435,12 +511,14 @@ where pub fn replies( client: &R, + token: Option<&str>, request: &RepliesRequest, ) -> Result> where R: SlackWebRequestSender, { let params = vec![ + token.map(|token| ("token", token.to_string())), request .channel .as_ref() @@ -483,6 +561,7 @@ where pub fn set_purpose( client: &R, + token: Option<&str>, request: &SetPurposeRequest, ) -> Result> where @@ -501,7 +580,11 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/conversations.setPurpose"); client - .post(&url, ¶ms[..], &[]) + .post( + &url, + ¶ms[..], + &token.map_or(vec![], |t| vec![("token", t.to_string())]), + ) .map_err(SetPurposeError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -514,6 +597,7 @@ where pub fn set_topic( client: &R, + token: Option<&str>, request: &SetTopicRequest, ) -> Result> where @@ -532,7 +616,11 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/conversations.setTopic"); client - .post(&url, ¶ms[..], &[]) + .post( + &url, + ¶ms[..], + &token.map_or(vec![], |t| vec![("token", t.to_string())]), + ) .map_err(SetTopicError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -545,6 +633,7 @@ where pub fn unarchive( client: &R, + token: Option<&str>, request: &UnarchiveRequest, ) -> Result> where @@ -557,7 +646,11 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/conversations.unarchive"); client - .post(&url, ¶ms[..], &[]) + .post( + &url, + ¶ms[..], + &token.map_or(vec![], |t| vec![("token", t.to_string())]), + ) .map_err(UnarchiveError::Client) .and_then(|result| { serde_json::from_str::(&result) diff --git a/src/sync/mods/dialog.rs b/src/sync/mods/dialog.rs index 0823dc3f..0c972d5c 100644 --- a/src/sync/mods/dialog.rs +++ b/src/sync/mods/dialog.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub use crate::mod_types::dialog_types::*; use crate::sync::SlackWebRequestSender; @@ -23,11 +23,16 @@ use crate::sync::SlackWebRequestSender; /// /// Wraps https://api.slack.com/methods/dialog.open -pub fn open(client: &R, request: &OpenRequest) -> Result> +pub fn open( + client: &R, + token: &str, + request: &OpenRequest, +) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), Some(("dialog", request.dialog.to_string())), Some(("trigger_id", request.trigger_id.to_string())), ]; diff --git a/src/sync/mods/dnd.rs b/src/sync/mods/dnd.rs index b8854898..1e8a19cf 100644 --- a/src/sync/mods/dnd.rs +++ b/src/sync/mods/dnd.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub use crate::mod_types::dnd_types::*; use crate::sync::SlackWebRequestSender; @@ -25,7 +25,8 @@ use crate::sync::SlackWebRequestSender; pub fn end_dnd( client: &R, - request: &EndDndRequest, + token: &str, + _request: &EndDndRequest, ) -> Result> where R: SlackWebRequestSender, @@ -34,7 +35,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/dnd.endDnd"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(EndDndError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -47,7 +48,8 @@ where pub fn end_snooze( client: &R, - request: &EndSnoozeRequest, + token: &str, + _request: &EndSnoozeRequest, ) -> Result> where R: SlackWebRequestSender, @@ -56,7 +58,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/dnd.endSnooze"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(EndSnoozeError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -67,11 +69,18 @@ where /// /// Wraps https://api.slack.com/methods/dnd.info -pub fn info(client: &R, request: &InfoRequest) -> Result> +pub fn info( + client: &R, + token: Option<&str>, + request: &InfoRequest, +) -> Result> where R: SlackWebRequestSender, { - let params = vec![request.user.as_ref().map(|user| ("user", user.to_string()))]; + let params = vec![ + token.map(|token| ("token", token.to_string())), + request.user.as_ref().map(|user| ("user", user.to_string())), + ]; let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/dnd.info"); client @@ -88,6 +97,7 @@ where pub fn set_snooze( client: &R, + token: &str, request: &SetSnoozeRequest, ) -> Result> where @@ -97,7 +107,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/dnd.setSnooze"); client - .post(&url, ¶ms[..], &[("token", request.token.clone())]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(SetSnoozeError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -110,15 +120,19 @@ where pub fn team_info( client: &R, + token: Option<&str>, request: &TeamInfoRequest, ) -> Result> where R: SlackWebRequestSender, { - let params = vec![request - .users - .as_ref() - .map(|users| ("users", users.to_string()))]; + let params = vec![ + token.map(|token| ("token", token.to_string())), + request + .users + .as_ref() + .map(|users| ("users", users.to_string())), + ]; let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/dnd.teamInfo"); client diff --git a/src/sync/mods/emoji.rs b/src/sync/mods/emoji.rs index 6ce40c65..18c1f371 100644 --- a/src/sync/mods/emoji.rs +++ b/src/sync/mods/emoji.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub use crate::mod_types::emoji_types::*; use crate::sync::SlackWebRequestSender; @@ -23,11 +23,15 @@ use crate::sync::SlackWebRequestSender; /// /// Wraps https://api.slack.com/methods/emoji.list -pub fn list(client: &R, request: &ListRequest) -> Result> +pub fn list( + client: &R, + token: &str, + _request: &ListRequest, +) -> Result> where R: SlackWebRequestSender, { - let params = vec![]; + let params = vec![Some(("token", token.to_string()))]; let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/emoji.list"); client diff --git a/src/sync/mods/files/comments.rs b/src/sync/mods/files/comments.rs index 9c126662..0032e427 100644 --- a/src/sync/mods/files/comments.rs +++ b/src/sync/mods/files/comments.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub use crate::mod_types::files::comments_types::*; use crate::sync::SlackWebRequestSender; @@ -25,6 +25,7 @@ use crate::sync::SlackWebRequestSender; pub fn delete( client: &R, + token: Option<&str>, request: &DeleteRequest, ) -> Result> where @@ -37,7 +38,11 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/files.comments.delete"); client - .post(&url, ¶ms[..], &[]) + .post( + &url, + ¶ms[..], + &token.map_or(vec![], |t| vec![("token", t.to_string())]), + ) .map_err(DeleteError::Client) .and_then(|result| { serde_json::from_str::(&result) diff --git a/src/sync/mods/files/mod.rs b/src/sync/mods/files/mod.rs index a108e0ed..ef425dce 100644 --- a/src/sync/mods/files/mod.rs +++ b/src/sync/mods/files/mod.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub mod comments; pub mod remote; @@ -28,6 +28,7 @@ use crate::sync::SlackWebRequestSender; pub fn delete( client: &R, + token: Option<&str>, request: &DeleteRequest, ) -> Result> where @@ -37,7 +38,11 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/files.delete"); client - .post(&url, ¶ms[..], &[]) + .post( + &url, + ¶ms[..], + &token.map_or(vec![], |t| vec![("token", t.to_string())]), + ) .map_err(DeleteError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -48,11 +53,16 @@ where /// /// Wraps https://api.slack.com/methods/files.info -pub fn info(client: &R, request: &InfoRequest) -> Result> +pub fn info( + client: &R, + token: Option<&str>, + request: &InfoRequest, +) -> Result> where R: SlackWebRequestSender, { let params = vec![ + token.map(|token| ("token", token.to_string())), request .count .as_ref() @@ -82,11 +92,16 @@ where /// /// Wraps https://api.slack.com/methods/files.list -pub fn list(client: &R, request: &ListRequest) -> Result> +pub fn list( + client: &R, + token: Option<&str>, + request: &ListRequest, +) -> Result> where R: SlackWebRequestSender, { let params = vec![ + token.map(|token| ("token", token.to_string())), request .channel .as_ref() @@ -135,6 +150,7 @@ where pub fn revoke_public_url( client: &R, + token: Option<&str>, request: &RevokePublicURLRequest, ) -> Result> where @@ -144,7 +160,11 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/files.revokePublicURL"); client - .post(&url, ¶ms[..], &[]) + .post( + &url, + ¶ms[..], + &token.map_or(vec![], |t| vec![("token", t.to_string())]), + ) .map_err(RevokePublicURLError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -157,6 +177,7 @@ where pub fn shared_public_url( client: &R, + token: Option<&str>, request: &SharedPublicURLRequest, ) -> Result> where @@ -166,7 +187,11 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/files.sharedPublicURL"); client - .post(&url, ¶ms[..], &[]) + .post( + &url, + ¶ms[..], + &token.map_or(vec![], |t| vec![("token", t.to_string())]), + ) .map_err(SharedPublicURLError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -179,6 +204,7 @@ where pub fn upload( client: &R, + token: Option<&str>, request: &UploadRequest, ) -> Result> where @@ -221,10 +247,7 @@ where .post( &url, ¶ms[..], - &request - .token - .as_ref() - .map_or(vec![], |t| vec![("token", t.into())]), + &token.map_or(vec![], |t| vec![("token", t.to_string())]), ) .map_err(UploadError::Client) .and_then(|result| { diff --git a/src/sync/mods/files/remote.rs b/src/sync/mods/files/remote.rs index 438d2e70..398f8b48 100644 --- a/src/sync/mods/files/remote.rs +++ b/src/sync/mods/files/remote.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub use crate::mod_types::files::remote_types::*; use crate::sync::SlackWebRequestSender; @@ -23,7 +23,11 @@ use crate::sync::SlackWebRequestSender; /// /// Wraps https://api.slack.com/methods/files.remote.add -pub fn add(client: &R, request: &AddRequest) -> Result> +pub fn add( + client: &R, + token: Option<&str>, + request: &AddRequest, +) -> Result> where R: SlackWebRequestSender, { @@ -64,10 +68,7 @@ where .post( &url, ¶ms[..], - &request - .token - .as_ref() - .map_or(vec![], |t| vec![("token", t.into())]), + &token.map_or(vec![], |t| vec![("token", t.to_string())]), ) .map_err(AddError::Client) .and_then(|result| { @@ -79,11 +80,16 @@ where /// /// Wraps https://api.slack.com/methods/files.remote.info -pub fn info(client: &R, request: &InfoRequest) -> Result> +pub fn info( + client: &R, + token: Option<&str>, + request: &InfoRequest, +) -> Result> where R: SlackWebRequestSender, { let params = vec![ + token.map(|token| ("token", token.to_string())), request .external_id .as_ref() @@ -104,11 +110,16 @@ where /// /// Wraps https://api.slack.com/methods/files.remote.list -pub fn list(client: &R, request: &ListRequest) -> Result> +pub fn list( + client: &R, + token: Option<&str>, + request: &ListRequest, +) -> Result> where R: SlackWebRequestSender, { let params = vec![ + token.map(|token| ("token", token.to_string())), request .channel .as_ref() @@ -146,6 +157,7 @@ where pub fn remove( client: &R, + token: Option<&str>, request: &RemoveRequest, ) -> Result> where @@ -164,10 +176,7 @@ where .post( &url, ¶ms[..], - &request - .token - .as_ref() - .map_or(vec![], |t| vec![("token", t.into())]), + &token.map_or(vec![], |t| vec![("token", t.to_string())]), ) .map_err(RemoveError::Client) .and_then(|result| { @@ -179,11 +188,16 @@ where /// /// Wraps https://api.slack.com/methods/files.remote.share -pub fn share(client: &R, request: &ShareRequest) -> Result> +pub fn share( + client: &R, + token: Option<&str>, + request: &ShareRequest, +) -> Result> where R: SlackWebRequestSender, { let params = vec![ + token.map(|token| ("token", token.to_string())), request .channels .as_ref() @@ -210,6 +224,7 @@ where pub fn update( client: &R, + token: Option<&str>, request: &UpdateRequest, ) -> Result> where @@ -253,10 +268,7 @@ where .post( &url, ¶ms[..], - &request - .token - .as_ref() - .map_or(vec![], |t| vec![("token", t.into())]), + &token.map_or(vec![], |t| vec![("token", t.to_string())]), ) .map_err(UpdateError::Client) .and_then(|result| { diff --git a/src/sync/mods/migration.rs b/src/sync/mods/migration.rs index f7fd01c4..8650cefb 100644 --- a/src/sync/mods/migration.rs +++ b/src/sync/mods/migration.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub use crate::mod_types::migration_types::*; use crate::sync::SlackWebRequestSender; @@ -25,12 +25,14 @@ use crate::sync::SlackWebRequestSender; pub fn exchange( client: &R, + token: &str, request: &ExchangeRequest, ) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), request .team_id .as_ref() diff --git a/src/sync/mods/oauth/mod.rs b/src/sync/mods/oauth/mod.rs index 4e25d0ae..5622b3ea 100644 --- a/src/sync/mods/oauth/mod.rs +++ b/src/sync/mods/oauth/mod.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub mod v_2; diff --git a/src/sync/mods/oauth/v_2.rs b/src/sync/mods/oauth/v_2.rs index 1c4f4912..833c0a6a 100644 --- a/src/sync/mods/oauth/v_2.rs +++ b/src/sync/mods/oauth/v_2.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub use crate::mod_types::oauth::v_2_types::*; use crate::sync::SlackWebRequestSender; diff --git a/src/sync/mods/pins.rs b/src/sync/mods/pins.rs index 374150b1..7fe69289 100644 --- a/src/sync/mods/pins.rs +++ b/src/sync/mods/pins.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub use crate::mod_types::pins_types::*; use crate::sync::SlackWebRequestSender; @@ -23,7 +23,11 @@ use crate::sync::SlackWebRequestSender; /// /// Wraps https://api.slack.com/methods/pins.add -pub fn add(client: &R, request: &AddRequest) -> Result> +pub fn add( + client: &R, + token: &str, + request: &AddRequest, +) -> Result> where R: SlackWebRequestSender, { @@ -37,7 +41,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/pins.add"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(AddError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -48,11 +52,18 @@ where /// /// Wraps https://api.slack.com/methods/pins.list -pub fn list(client: &R, request: &ListRequest) -> Result> +pub fn list( + client: &R, + token: &str, + request: &ListRequest, +) -> Result> where R: SlackWebRequestSender, { - let params = vec![Some(("channel", request.channel.to_string()))]; + let params = vec![ + Some(("token", token.to_string())), + Some(("channel", request.channel.to_string())), + ]; let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/pins.list"); client @@ -69,6 +80,7 @@ where pub fn remove( client: &R, + token: &str, request: &RemoveRequest, ) -> Result> where @@ -84,7 +96,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/pins.remove"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(RemoveError::Client) .and_then(|result| { serde_json::from_str::(&result) diff --git a/src/sync/mods/reactions.rs b/src/sync/mods/reactions.rs index 03a29d80..751b7ddc 100644 --- a/src/sync/mods/reactions.rs +++ b/src/sync/mods/reactions.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub use crate::mod_types::reactions_types::*; use crate::sync::SlackWebRequestSender; @@ -23,7 +23,11 @@ use crate::sync::SlackWebRequestSender; /// /// Wraps https://api.slack.com/methods/reactions.add -pub fn add(client: &R, request: &AddRequest) -> Result> +pub fn add( + client: &R, + token: &str, + request: &AddRequest, +) -> Result> where R: SlackWebRequestSender, { @@ -35,7 +39,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/reactions.add"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(AddError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -46,11 +50,16 @@ where /// /// Wraps https://api.slack.com/methods/reactions.get -pub fn get(client: &R, request: &GetRequest) -> Result> +pub fn get( + client: &R, + token: &str, + request: &GetRequest, +) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), request .channel .as_ref() @@ -80,11 +89,16 @@ where /// /// Wraps https://api.slack.com/methods/reactions.list -pub fn list(client: &R, request: &ListRequest) -> Result> +pub fn list( + client: &R, + token: &str, + request: &ListRequest, +) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), request .count .as_ref() @@ -117,6 +131,7 @@ where pub fn remove( client: &R, + token: &str, request: &RemoveRequest, ) -> Result> where @@ -141,7 +156,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/reactions.remove"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(RemoveError::Client) .and_then(|result| { serde_json::from_str::(&result) diff --git a/src/sync/mods/reminders.rs b/src/sync/mods/reminders.rs index 1c3e106d..29db7afe 100644 --- a/src/sync/mods/reminders.rs +++ b/src/sync/mods/reminders.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub use crate::mod_types::reminders_types::*; use crate::sync::SlackWebRequestSender; @@ -23,7 +23,11 @@ use crate::sync::SlackWebRequestSender; /// /// Wraps https://api.slack.com/methods/reminders.add -pub fn add(client: &R, request: &AddRequest) -> Result> +pub fn add( + client: &R, + token: &str, + request: &AddRequest, +) -> Result> where R: SlackWebRequestSender, { @@ -35,7 +39,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/reminders.add"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(AddError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -48,6 +52,7 @@ where pub fn complete( client: &R, + token: Option<&str>, request: &CompleteRequest, ) -> Result> where @@ -60,7 +65,11 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/reminders.complete"); client - .post(&url, ¶ms[..], &[]) + .post( + &url, + ¶ms[..], + &token.map_or(vec![], |t| vec![("token", t.to_string())]), + ) .map_err(CompleteError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -73,6 +82,7 @@ where pub fn delete( client: &R, + token: Option<&str>, request: &DeleteRequest, ) -> Result> where @@ -85,7 +95,11 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/reminders.delete"); client - .post(&url, ¶ms[..], &[]) + .post( + &url, + ¶ms[..], + &token.map_or(vec![], |t| vec![("token", t.to_string())]), + ) .map_err(DeleteError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -96,14 +110,21 @@ where /// /// Wraps https://api.slack.com/methods/reminders.info -pub fn info(client: &R, request: &InfoRequest) -> Result> +pub fn info( + client: &R, + token: Option<&str>, + request: &InfoRequest, +) -> Result> where R: SlackWebRequestSender, { - let params = vec![request - .reminder - .as_ref() - .map(|reminder| ("reminder", reminder.to_string()))]; + let params = vec![ + token.map(|token| ("token", token.to_string())), + request + .reminder + .as_ref() + .map(|reminder| ("reminder", reminder.to_string())), + ]; let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/reminders.info"); client @@ -118,11 +139,15 @@ where /// /// Wraps https://api.slack.com/methods/reminders.list -pub fn list(client: &R, request: &ListRequest) -> Result> +pub fn list( + client: &R, + token: Option<&str>, + _request: &ListRequest, +) -> Result> where R: SlackWebRequestSender, { - let params = vec![]; + let params = vec![token.map(|token| ("token", token.to_string()))]; let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/reminders.list"); client diff --git a/src/sync/mods/rtm.rs b/src/sync/mods/rtm.rs index 035441e3..62905f1a 100644 --- a/src/sync/mods/rtm.rs +++ b/src/sync/mods/rtm.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub use crate::mod_types::rtm_types::*; use crate::sync::SlackWebRequestSender; @@ -25,12 +25,14 @@ use crate::sync::SlackWebRequestSender; pub fn connect( client: &R, + token: &str, request: &ConnectRequest, ) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), request .batch_presence_aware .as_ref() diff --git a/src/sync/mods/search.rs b/src/sync/mods/search.rs index 6b09a4d0..d30022c0 100644 --- a/src/sync/mods/search.rs +++ b/src/sync/mods/search.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub use crate::mod_types::search_types::*; use crate::sync::SlackWebRequestSender; @@ -25,12 +25,14 @@ use crate::sync::SlackWebRequestSender; pub fn messages( client: &R, + token: &str, request: &MessagesRequest, ) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), request .count .as_ref() diff --git a/src/sync/mods/stars.rs b/src/sync/mods/stars.rs index 98e4a345..02a87ef0 100644 --- a/src/sync/mods/stars.rs +++ b/src/sync/mods/stars.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub use crate::mod_types::stars_types::*; use crate::sync::SlackWebRequestSender; @@ -23,7 +23,11 @@ use crate::sync::SlackWebRequestSender; /// /// Wraps https://api.slack.com/methods/stars.add -pub fn add(client: &R, request: &AddRequest) -> Result> +pub fn add( + client: &R, + token: &str, + request: &AddRequest, +) -> Result> where R: SlackWebRequestSender, { @@ -45,7 +49,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/stars.add"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(AddError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -56,11 +60,16 @@ where /// /// Wraps https://api.slack.com/methods/stars.list -pub fn list(client: &R, request: &ListRequest) -> Result> +pub fn list( + client: &R, + token: Option<&str>, + request: &ListRequest, +) -> Result> where R: SlackWebRequestSender, { let params = vec![ + token.map(|token| ("token", token.to_string())), request .count .as_ref() @@ -91,6 +100,7 @@ where pub fn remove( client: &R, + token: &str, request: &RemoveRequest, ) -> Result> where @@ -114,7 +124,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/stars.remove"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(RemoveError::Client) .and_then(|result| { serde_json::from_str::(&result) diff --git a/src/sync/mods/team/mod.rs b/src/sync/mods/team/mod.rs index 8dd610bc..dce6f2ad 100644 --- a/src/sync/mods/team/mod.rs +++ b/src/sync/mods/team/mod.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub mod profile; @@ -27,12 +27,14 @@ use crate::sync::SlackWebRequestSender; pub fn access_logs( client: &R, + token: &str, request: &AccessLogsRequest, ) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), request .before .as_ref() @@ -59,12 +61,16 @@ where pub fn billable_info( client: &R, + token: &str, request: &BillableInfoRequest, ) -> Result> where R: SlackWebRequestSender, { - let params = vec![request.user.as_ref().map(|user| ("user", user.to_string()))]; + let params = vec![ + Some(("token", token.to_string())), + request.user.as_ref().map(|user| ("user", user.to_string())), + ]; let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/team.billableInfo"); client @@ -79,11 +85,18 @@ where /// /// Wraps https://api.slack.com/methods/team.info -pub fn info(client: &R, request: &InfoRequest) -> Result> +pub fn info( + client: &R, + token: &str, + request: &InfoRequest, +) -> Result> where R: SlackWebRequestSender, { - let params = vec![request.team.as_ref().map(|team| ("team", team.to_string()))]; + let params = vec![ + Some(("token", token.to_string())), + request.team.as_ref().map(|team| ("team", team.to_string())), + ]; let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/team.info"); client @@ -100,12 +113,14 @@ where pub fn integration_logs( client: &R, + token: &str, request: &IntegrationLogsRequest, ) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), request .app_id .as_ref() diff --git a/src/sync/mods/team/profile.rs b/src/sync/mods/team/profile.rs index f684ace6..8ba3d9f7 100644 --- a/src/sync/mods/team/profile.rs +++ b/src/sync/mods/team/profile.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub use crate::mod_types::team::profile_types::*; use crate::sync::SlackWebRequestSender; @@ -23,14 +23,21 @@ use crate::sync::SlackWebRequestSender; /// /// Wraps https://api.slack.com/methods/team.profile.get -pub fn get(client: &R, request: &GetRequest) -> Result> +pub fn get( + client: &R, + token: &str, + request: &GetRequest, +) -> Result> where R: SlackWebRequestSender, { - let params = vec![request - .visibility - .as_ref() - .map(|visibility| ("visibility", visibility.to_string()))]; + let params = vec![ + Some(("token", token.to_string())), + request + .visibility + .as_ref() + .map(|visibility| ("visibility", visibility.to_string())), + ]; let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/team.profile.get"); client diff --git a/src/sync/mods/usergroups/mod.rs b/src/sync/mods/usergroups/mod.rs index b02209e8..7385e30c 100644 --- a/src/sync/mods/usergroups/mod.rs +++ b/src/sync/mods/usergroups/mod.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub mod users; @@ -27,6 +27,7 @@ use crate::sync::SlackWebRequestSender; pub fn create( client: &R, + token: &str, request: &CreateRequest, ) -> Result> where @@ -54,7 +55,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/usergroups.create"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(CreateError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -67,6 +68,7 @@ where pub fn disable( client: &R, + token: &str, request: &DisableRequest, ) -> Result> where @@ -82,7 +84,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/usergroups.disable"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(DisableError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -95,6 +97,7 @@ where pub fn enable( client: &R, + token: &str, request: &EnableRequest, ) -> Result> where @@ -110,7 +113,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/usergroups.enable"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(EnableError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -121,11 +124,16 @@ where /// /// Wraps https://api.slack.com/methods/usergroups.list -pub fn list(client: &R, request: &ListRequest) -> Result> +pub fn list( + client: &R, + token: &str, + request: &ListRequest, +) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), request .include_count .as_ref() @@ -155,6 +163,7 @@ where pub fn update( client: &R, + token: &str, request: &UpdateRequest, ) -> Result> where @@ -183,7 +192,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/usergroups.update"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(UpdateError::Client) .and_then(|result| { serde_json::from_str::(&result) diff --git a/src/sync/mods/usergroups/users.rs b/src/sync/mods/usergroups/users.rs index 3fd08ddc..70ee0be0 100644 --- a/src/sync/mods/usergroups/users.rs +++ b/src/sync/mods/usergroups/users.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub use crate::mod_types::usergroups::users_types::*; use crate::sync::SlackWebRequestSender; @@ -23,11 +23,16 @@ use crate::sync::SlackWebRequestSender; /// /// Wraps https://api.slack.com/methods/usergroups.users.list -pub fn list(client: &R, request: &ListRequest) -> Result> +pub fn list( + client: &R, + token: &str, + request: &ListRequest, +) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), request .include_disabled .as_ref() @@ -50,6 +55,7 @@ where pub fn update( client: &R, + token: &str, request: &UpdateRequest, ) -> Result> where @@ -66,7 +72,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/usergroups.users.update"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(UpdateError::Client) .and_then(|result| { serde_json::from_str::(&result) diff --git a/src/sync/mods/users/mod.rs b/src/sync/mods/users/mod.rs index b0b41de1..9a9190ec 100644 --- a/src/sync/mods/users/mod.rs +++ b/src/sync/mods/users/mod.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub mod profile; @@ -27,12 +27,14 @@ use crate::sync::SlackWebRequestSender; pub fn conversations( client: &R, + token: Option<&str>, request: &ConversationsRequest, ) -> Result> where R: SlackWebRequestSender, { let params = vec![ + token.map(|token| ("token", token.to_string())), request .cursor .as_ref() @@ -67,7 +69,8 @@ where pub fn delete_photo( client: &R, - request: &DeletePhotoRequest, + token: &str, + _request: &DeletePhotoRequest, ) -> Result> where R: SlackWebRequestSender, @@ -76,7 +79,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/users.deletePhoto"); client - .post(&url, ¶ms[..], &[("token", request.token.clone())]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(DeletePhotoError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -89,12 +92,16 @@ where pub fn get_presence( client: &R, + token: &str, request: &GetPresenceRequest, ) -> Result> where R: SlackWebRequestSender, { - let params = vec![request.user.as_ref().map(|user| ("user", user.to_string()))]; + let params = vec![ + Some(("token", token.to_string())), + request.user.as_ref().map(|user| ("user", user.to_string())), + ]; let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/users.getPresence"); client @@ -111,12 +118,13 @@ where pub fn identity( client: &R, - request: &IdentityRequest, + token: Option<&str>, + _request: &IdentityRequest, ) -> Result> where R: SlackWebRequestSender, { - let params = vec![]; + let params = vec![token.map(|token| ("token", token.to_string()))]; let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/users.identity"); client @@ -131,11 +139,16 @@ where /// /// Wraps https://api.slack.com/methods/users.info -pub fn info(client: &R, request: &InfoRequest) -> Result> +pub fn info( + client: &R, + token: &str, + request: &InfoRequest, +) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), request .include_locale .as_ref() @@ -156,11 +169,16 @@ where /// /// Wraps https://api.slack.com/methods/users.list -pub fn list(client: &R, request: &ListRequest) -> Result> +pub fn list( + client: &R, + token: Option<&str>, + request: &ListRequest, +) -> Result> where R: SlackWebRequestSender, { let params = vec![ + token.map(|token| ("token", token.to_string())), request .cursor .as_ref() @@ -190,12 +208,16 @@ where pub fn lookup_by_email( client: &R, + token: &str, request: &LookupByEmailRequest, ) -> Result> where R: SlackWebRequestSender, { - let params = vec![Some(("email", request.email.to_string()))]; + let params = vec![ + Some(("token", token.to_string())), + Some(("email", request.email.to_string())), + ]; let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/users.lookupByEmail"); client @@ -212,7 +234,8 @@ where pub fn set_active( client: &R, - request: &SetActiveRequest, + token: &str, + _request: &SetActiveRequest, ) -> Result> where R: SlackWebRequestSender, @@ -221,7 +244,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/users.setActive"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(SetActiveError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -234,6 +257,7 @@ where pub fn set_photo( client: &R, + token: &str, request: &SetPhotoRequest, ) -> Result> where @@ -260,7 +284,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/users.setPhoto"); client - .post(&url, ¶ms[..], &[("token", request.token.clone())]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(SetPhotoError::Client) .and_then(|result| { serde_json::from_str::(&result) @@ -273,6 +297,7 @@ where pub fn set_presence( client: &R, + token: &str, request: &SetPresenceRequest, ) -> Result> where @@ -282,7 +307,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/users.setPresence"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(SetPresenceError::Client) .and_then(|result| { serde_json::from_str::(&result) diff --git a/src/sync/mods/users/profile.rs b/src/sync/mods/users/profile.rs index e751e9e1..e39edd79 100644 --- a/src/sync/mods/users/profile.rs +++ b/src/sync/mods/users/profile.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub use crate::mod_types::users::profile_types::*; use crate::sync::SlackWebRequestSender; @@ -23,11 +23,16 @@ use crate::sync::SlackWebRequestSender; /// /// Wraps https://api.slack.com/methods/users.profile.get -pub fn get(client: &R, request: &GetRequest) -> Result> +pub fn get( + client: &R, + token: &str, + request: &GetRequest, +) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), request .include_labels .as_ref() @@ -48,7 +53,11 @@ where /// /// Wraps https://api.slack.com/methods/users.profile.set -pub fn set(client: &R, request: &SetRequest) -> Result> +pub fn set( + client: &R, + token: &str, + request: &SetRequest, +) -> Result> where R: SlackWebRequestSender, { @@ -67,7 +76,7 @@ where let params: Vec<(&str, String)> = params.into_iter().filter_map(|x| x).collect::>(); let url = crate::get_slack_url_for_method("/users.profile.set"); client - .post(&url, ¶ms[..], &[]) + .post(&url, ¶ms[..], &[("token", token.to_string())]) .map_err(SetError::Client) .and_then(|result| { serde_json::from_str::(&result) diff --git a/src/sync/mods/views.rs b/src/sync/mods/views.rs index af6ce2ab..79496b83 100644 --- a/src/sync/mods/views.rs +++ b/src/sync/mods/views.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub use crate::mod_types::views_types::*; use crate::sync::SlackWebRequestSender; @@ -23,11 +23,16 @@ use crate::sync::SlackWebRequestSender; /// /// Wraps https://api.slack.com/methods/views.open -pub fn open(client: &R, request: &OpenRequest) -> Result> +pub fn open( + client: &R, + token: &str, + request: &OpenRequest, +) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), Some(("trigger_id", request.trigger_id.to_string())), Some(("view", request.view.to_string())), ]; @@ -47,12 +52,14 @@ where pub fn publish( client: &R, + token: &str, request: &PublishRequest, ) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), request.hash.as_ref().map(|hash| ("hash", hash.to_string())), Some(("user_id", request.user_id.to_string())), Some(("view", request.view.to_string())), @@ -71,11 +78,16 @@ where /// /// Wraps https://api.slack.com/methods/views.push -pub fn push(client: &R, request: &PushRequest) -> Result> +pub fn push( + client: &R, + token: &str, + request: &PushRequest, +) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), Some(("trigger_id", request.trigger_id.to_string())), Some(("view", request.view.to_string())), ]; @@ -95,12 +107,14 @@ where pub fn update( client: &R, + token: &str, request: &UpdateRequest, ) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), request .external_id .as_ref() diff --git a/src/sync/mods/workflows.rs b/src/sync/mods/workflows.rs index 5c17e469..7948d7d4 100644 --- a/src/sync/mods/workflows.rs +++ b/src/sync/mods/workflows.rs @@ -12,9 +12,9 @@ // //============================================================================= -#![allow(unused_variables)] #![allow(unused_imports)] -#![allow(dead_code)] +#![allow(clippy::match_single_binding)] +#![allow(clippy::blacklisted_name)] pub use crate::mod_types::workflows_types::*; use crate::sync::SlackWebRequestSender; @@ -25,12 +25,14 @@ use crate::sync::SlackWebRequestSender; pub fn step_completed( client: &R, + token: &str, request: &StepCompletedRequest, ) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), request .outputs .as_ref() @@ -56,12 +58,14 @@ where pub fn step_failed( client: &R, + token: &str, request: &StepFailedRequest, ) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), Some(("error", request.error.to_string())), Some(( "workflow_step_execute_id", @@ -84,12 +88,14 @@ where pub fn update_step( client: &R, + token: &str, request: &UpdateStepRequest, ) -> Result> where R: SlackWebRequestSender, { let params = vec![ + Some(("token", token.to_string())), request .inputs .as_ref() diff --git a/src/sync/requests.rs b/src/sync/requests.rs index 6a507dc5..4dc26feb 100644 --- a/src/sync/requests.rs +++ b/src/sync/requests.rs @@ -13,11 +13,7 @@ mod reqwest_support { impl SlackWebRequestSender for Client { type Error = reqwest::Error; - fn get( - &self, - method_url: S, - params: &[(&str, String)], - ) -> Result + fn get(&self, method_url: S, params: &[(&str, String)]) -> Result where S: AsRef + Send, { @@ -55,7 +51,7 @@ mod reqwest_support { /// # let token = "some_token"; /// let client = slack_api::requests::default_client().unwrap(); /// let params = Default::default(); - /// let response = slack_api::channels::list(&client, &token, ¶ms); + /// let response = slack_api::conversations::list(&client, &token, ¶ms); /// ``` pub fn default_client() -> Result { Ok(Client::new()) diff --git a/src/types.rs b/src/types.rs index a183fa8c..42e4029e 100644 --- a/src/types.rs +++ b/src/types.rs @@ -12,6 +12,8 @@ // //============================================================================= +#![allow(clippy::large_enum_variant)] + use std::collections::HashMap; #[derive(Clone, Debug, Deserialize)] diff --git a/tests/smoke_test.rs b/tests/smoke_test.rs index 262df9a7..09deaa11 100644 --- a/tests/smoke_test.rs +++ b/tests/smoke_test.rs @@ -4,8 +4,7 @@ use slack_api as slack; use std::env; -fn get_setup( -) -> Result<(String, impl slack::requests::SlackWebRequestSender), Box> { +fn get_setup() -> Result<(String, impl slack::SlackWebRequestSender), Box> { // You can generate a legacy token to quickly test these apis // https://api.slack.com/custom-integrations/legacy-tokens let token = env::var("SLACK_API_TOKEN").map_err(|_| "SLACK_API_TOKEN env var must be set")?; @@ -21,8 +20,8 @@ async fn smoke_test() -> Result<(), Box> { let resp = slack::api::test( &client, &slack::api::TestRequest { - error: Some("my_error"), - foo: Some("it's me, foo"), + error: Some("my_error".into()), + foo: Some("it's me, foo".into()), }, ) .await @@ -38,56 +37,53 @@ async fn smoke_test() -> Result<(), Box> { async fn smoke_channels() -> Result<(), Box> { let (token, client) = get_setup()?; - let all_channels = slack::channels::list( + let all_channels = slack::conversations::list( &client, &token, - &slack::channels::ListRequest { - ..slack::channels::ListRequest::default() + &slack::conversations::ListRequest { + ..slack::conversations::ListRequest::default() }, ) .await? - .channels - .ok_or("Expected some channels")?; + .channels; - assert!(all_channels.len() > 0); + assert!(!all_channels.is_empty()); for channel in &all_channels[..10] { - let channel_id = channel.id.as_ref().ok_or("expected channel id")?; + let channel_id = &channel.id; - let channel_info = slack::channels::info( + let channel_info = slack::conversations::info( &client, &token, - &slack::channels::InfoRequest { - channel: &channel_id, + &slack::conversations::InfoRequest { + channel: channel_id.into(), ..Default::default() }, ) .await? - .channel - .ok_or("Expected some channel")?; + .channel; dbg!(channel_info.name); - let _channel_history = slack::channels::history( + let _channel_history = slack::conversations::history( &client, &token, - &slack::channels::HistoryRequest { - channel: &channel_id, - oldest: Some(1234567890.1234.into()), + &slack::conversations::HistoryRequest { + channel: channel_id.clone(), + oldest: Some(1234567890.1234), ..Default::default() }, ) .await .map_err(|e| { - if let slack::channels::HistoryError::MalformedResponse(r, inner_e) = e { + if let slack::conversations::HistoryError::MalformedResponse(r, inner_e) = e { println!("{}", r); Box::new(inner_e) as Box } else { Box::new(e) } })? - .messages - .ok_or("Expected some messages")?; + .messages; } Ok(())