Struct slack_blocks::elems::select::SelectBuilder [−][src]
pub struct SelectBuilder<'a> { /* fields omitted */ }
👎 Deprecated since 0.17.2:
use individual select builders instead
Expand description
Select Element Builder
Use to construct a Select element and easily choose a data source
Implementations
impl<'a> SelectBuilder<'a>
[src]
impl<'a> SelectBuilder<'a>
[src]pub fn from_placeholder_and_action_id(
placeholder: impl Into<Plain>,
action_id: impl Into<Cow<'a, str>>
) -> Self
[src]
pub fn from_placeholder_and_action_id(
placeholder: impl Into<Plain>,
action_id: impl Into<Cow<'a, str>>
) -> Self
[src]pub fn with_confirm(self, confirm: Confirm) -> Self
[src]
pub fn with_confirm(self, confirm: Confirm) -> Self
[src]Construct a Select block element from required parts
Arguments
confirm
: A confirm object 🔗 that defines an optional confirmation dialog that appears after a menu item is selected.
Example
use std::iter; use std::convert::TryFrom; use slack_blocks::{ blocks::{Block, Actions}, elems::{BlockElement, select::Select}, compose::{text, Confirm, text::ToSlackPlaintext}, }; let confirm = Confirm::from_parts( "Are you sure?", "Think hard about this.".plaintext(), "Yes", "No", ); let select: BlockElement = Select::from_placeholder_and_action_id("Pick a channel to delete!", "delete_chan_select") .with_confirm(confirm) .choose_from_public_channels() .into(); let block: Block = Actions::try_from(select).unwrap().into(); // < send `block` to slack API >
pub fn choose_from_public_channels(self) -> PublicChannel<'a>
[src]
pub fn choose_from_public_channels(self) -> PublicChannel<'a>
[src]Turn the builder into a Public Channel select element
Example
use std::iter; use std::convert::TryFrom; use slack_blocks::{ blocks::{Block, Section, Actions}, elems::{BlockElement, select::Select}, compose::{text, Confirm}, }; let confirm = Confirm::from_parts("Are you sure?", text::Mrkdwn::from("Think hard about this."), "Yes", "No"); let select: BlockElement = Select::from_placeholder_and_action_id("Pick a channel to delete!", "1234") .with_confirm(confirm) .choose_from_public_channels() .into(); let block: Block = Actions::try_from(select).unwrap().into(); // < send `block` to slack API >
pub fn choose_from_all_channels(self) -> Conversation<'a>
[src]
pub fn choose_from_all_channels(self) -> Conversation<'a>
[src]Set the data source to “All conversations”. See docs for select::Conversation
for more info.
Example
use std::iter; use std::convert::TryFrom; use slack_blocks::{ blocks::{Block, Section, Actions}, elems::{BlockElement, select::Select}, compose::{text, Confirm}, }; use text::ToSlackPlaintext; let select: BlockElement = Select::from_placeholder_and_action_id("Channel", "get_member_channel_select") .choose_from_all_channels() .into(); let blocks: Vec<Block> = vec![ Section::from_text("Get the members of a channel".plaintext()).into(), Actions::try_from(select).unwrap().into(), ]; // <send `blocks` to slack's API>
pub fn choose_from_users(self) -> User<'a>
[src]
pub fn choose_from_users(self) -> User<'a>
[src]Set the data source to “users”. See docs for select::User
for more info.
Example
use std::{convert::TryFrom, iter}; use slack_blocks::{blocks::{Actions, Block, Section}, elems::{select::Select, BlockElement}, text, text::ToSlackPlaintext}; let select: BlockElement = Select::from_placeholder_and_action_id("Choose a user to ban!!", "ban_chosen").choose_from_users() .into(); let blocks: Block = Actions::try_from(select).unwrap().into(); // <send `blocks` to slack's API>
pub fn choose_from_external(self) -> External<'a>
[src]
pub fn choose_from_external(self) -> External<'a>
[src]Users will choose from an external data source. See docs for select::External
for more info.
Example
use std::iter; use std::convert::TryFrom; use slack_blocks::{ text, text::ToSlackPlaintext, blocks::{Block, Section, Actions}, elems::{BlockElement, select::Select}, }; let select: BlockElement = Select::from_placeholder_and_action_id("Pick your favorite cheese", "cheese_chosen") .choose_from_external() .into(); let blocks: Block = Actions::try_from(select).unwrap().into(); // <send `blocks` to slack's API>