pub struct WorkflowButton { /* private fields */ }Expand description
Workflow button element representation.
§Fields and Validations
For more details, see the official documentation.
| Field | Type | Required | Validation |
|---|---|---|---|
| text | Text<Plain> | Yes | Max length 75 characters |
| action_id | String | Yes | Max length 255 characters |
| workflow | Workflow | Yes | N/A |
| style | &’static str | No | Must be one of “primary”, “danger” |
| accessibility_label | String | No | Max length 75 characters |
§Example
use slack_messaging::plain_text;
use slack_messaging::blocks::elements::WorkflowButton;
use slack_messaging::composition_objects::{types::InputParameter, Trigger, Workflow};
let button = WorkflowButton::builder()
.text(plain_text!("Run Workflow")?)
.action_id("workflowbutton123")
.workflow(
Workflow::builder()
.trigger(
Trigger::builder()
.url("https://slack.com/shortcuts/Ft0123ABC456/123...xyz")
.customizable_input_parameter(
InputParameter::builder()
.name("input_parameter_a")
.value("Value for input param A")
.build()?
)
.customizable_input_parameter(
InputParameter::builder()
.name("input_parameter_b")
.value("Value for input param B")
.build()?
)
.build()?
)
.build()?
)
.build()?;
let expected = serde_json::json!({
"type": "workflow_button",
"text": {
"type": "plain_text",
"text": "Run Workflow"
},
"action_id": "workflowbutton123",
"workflow": {
"trigger": {
"url": "https://slack.com/shortcuts/Ft0123ABC456/123...xyz",
"customizable_input_parameters": [
{
"name": "input_parameter_a",
"value": "Value for input param A"
},
{
"name": "input_parameter_b",
"value": "Value for input param B"
}
]
}
}
});
let json = serde_json::to_value(button).unwrap();
assert_eq!(json, expected);
// If your object has any validation errors, the build method returns Result::Err
let button = WorkflowButton::builder()
.text(plain_text!("Run Workflow")?)
.action_id("workflowbutton123")
.build();
assert!(button.is_err());Implementations§
Source§impl WorkflowButton
impl WorkflowButton
Sourcepub fn builder() -> WorkflowButtonBuilder
pub fn builder() -> WorkflowButtonBuilder
constract WorkflowButtonBuilder object.
Trait Implementations§
Source§impl Clone for WorkflowButton
impl Clone for WorkflowButton
Source§fn clone(&self) -> WorkflowButton
fn clone(&self) -> WorkflowButton
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for WorkflowButton
impl Debug for WorkflowButton
Source§impl From<WorkflowButton> for Accessory
impl From<WorkflowButton> for Accessory
Source§fn from(value: WorkflowButton) -> Self
fn from(value: WorkflowButton) -> Self
Converts to this type from the input type.
Source§impl From<WorkflowButton> for ActionsElement
impl From<WorkflowButton> for ActionsElement
Source§fn from(value: WorkflowButton) -> Self
fn from(value: WorkflowButton) -> Self
Converts to this type from the input type.
Source§impl PartialEq for WorkflowButton
impl PartialEq for WorkflowButton
Source§impl Serialize for WorkflowButton
impl Serialize for WorkflowButton
impl StructuralPartialEq for WorkflowButton
Auto Trait Implementations§
impl Freeze for WorkflowButton
impl RefUnwindSafe for WorkflowButton
impl Send for WorkflowButton
impl Sync for WorkflowButton
impl Unpin for WorkflowButton
impl UnwindSafe for WorkflowButton
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)