Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RELEASE] Release 1.0.9 #92

Merged
merged 3 commits into from
May 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions docs_src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,33 +20,33 @@ The [Slack BlockKit API](https://api.slack.com/block-kit) defines a number of
classes that represent these resources.

### Objects
[`Objects`](/reference/objects) (e.g. [`Text`](/reference/objects/#objects.Text))
[`Objects`](/slackblocks/latest/reference/objects) (e.g. [`Text`](/slackblocks/latest/reference/objects/#objects.Text))
are the lowest level pimitives that are used to populate
[`Elements`](/reference/elements) and [`Blocks`](/reference/blocks).
[`Elements`](/slackblocks/latest/reference/elements) and [`Blocks`](/slackblocks/latest/reference/blocks).

### Elements
[`Elements`](/reference/elements) are typically interactive UI elements that take
in [`Object`](/reference/objects) to define their content. For example, the
[`Elements`](/slackblocks/latest/reference/elements) are typically interactive UI elements that take
in [`Object`](/slackblocks/latest/reference/objects) to define their content. For example, the
[`CheckboxGroup`](/elements/#elements.CheckboxGroup) element takes in one or
more [`Option`](/reference/objects/#objects.Option) items and presents a
more [`Option`](/slackblocks/latest/reference/objects/#objects.Option) items and presents a
checkbox menu to the user with those options.

### Blocks
[`Blocks`](/reference/blocks) are the core element of the API, with different
[`Blocks`](/reference/blocks) used to create different types of visual
elements. For example, the [`DividerBlock`](/reference/blocks/#blocks.DividerBlock),
[`Blocks`](/slackblocks/latest/reference/blocks) are the core element of the API, with different
[`Blocks`](/slackblocks/latest/reference/blocks) used to create different types of visual
elements. For example, the [`DividerBlock`](/slackblocks/latest/reference/blocks/#blocks.DividerBlock),
when rendered, will show a visual element similar to a `<hr>` HTML element. The
[`RichTextBlock`](/reference/blocks/#blocks.RichTextBlock) on the other hand
[`RichTextBlock`](/slackblocks/latest/reference/blocks/#blocks.RichTextBlock) on the other hand
allows for the display of text elements with visual styling like italics,
block quotes, lists and code blocks.

### Messages
[`Messages`](/reference/messages/) are a convenience wrapper around `Blocks` that
[`Messages`](/slackblocks/latest/reference/messages/) are a convenience wrapper around `Blocks` that
can be unpacked as arguments straight into the official Slack Python SDK (or
its legacy `slackclient` counterpart).

### Views
[`Views`](reference/views/) are an alternative usage for [`Blocks`](/reference/blocks)
[`Views`](reference/views/) are an alternative usage for [`Blocks`](/slackblocks/latest/reference/blocks)
that allow for the creation of custom UI "surfaces" within Slack, e.g. for
third-party apps.

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "slackblocks"
version = "1.0.8"
version = "1.0.9"
description = "Python wrapper for the Slack Blocks API"
authors = [
"Nicholas Lambourne <[email protected]>",
Expand Down
4 changes: 2 additions & 2 deletions slackblocks/attachments.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Secondary (less important) content can be attached using the deprecated
attachments API.

See: <https://api.slack.com/reference/messaging/attachments>.
See: <https://api.slack.com/slackblocks/latest/reference/messaging/attachments>.
"""

from enum import Enum
Expand All @@ -19,7 +19,7 @@ class Color(Enum):
Color is a utility class for use with the Slack secondary attachments API.

Pass these to the `color` argument of
[`Attachment`](/reference/attachments/#attachments.Attachment).
[`Attachment`](/slackblocks/latest/reference/attachments/#attachments.Attachment).

<table style="width:50%">
<tr>
Expand Down
24 changes: 14 additions & 10 deletions slackblocks/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ class ActionsBlock(Block):
A `Block` that is used to hold interactive elements (normally for users to interface with).

Args:
elements: a list of [Elements](/reference/elements) (up to a maximum of 25).
elements: a list of [Elements](/slackblocks/latest/reference/elements)
(up to a maximum of 25).
block_id: you can use this field to provide a deterministic identifier for the block.

Throws:
Expand Down Expand Up @@ -304,9 +305,10 @@ class InputBlock(Block):

Args:
label: the name which identifies the input field.
element: an interactive [Element](/reference/elements) (e.g. a text field).
dispatch_action: whether the [Element](/reference/elements) should trigger the
sending of a `block_actions` payload.
element: an interactive [Element](/slackblocks/latest/reference/elements)
(e.g. a text field).
dispatch_action: whether the [Element](/slackblocks/latest/reference/elements)
should trigger the sending of a `block_actions` payload.
block_id: you can use this field to provide a deterministic identifier for the block.
hint: an optional additional guide on what input the user should prodive.
optional: whether this input field may be empty when the user submits e.g. the modal.
Expand Down Expand Up @@ -354,13 +356,13 @@ class RichTextBlock(Block):
"""
A RichTextBlock is used to provide easier rich text formatting
than standard markdown text (e.g. in a
[`SectionBlock`](/reference/blocks/#blocks.SectionBlock))
[`SectionBlock`](/slackblocks/latest/reference/blocks/#blocks.SectionBlock))
and access to text formatting features not available in traditional
markdown (e.g. strikethrough). See the various rich text elements
you can include [here](/reference/rich_text).
you can include [here](/slackblocks/latest/reference/rich_text).

Args:
elements: a single [rich text element](../../reference/rich_text)
elements: a single [rich text element](rich_text)
or a list of those elements.
block_id: you can use this field to provide a deterministic identifier
for the block.
Expand Down Expand Up @@ -400,16 +402,18 @@ class SectionBlock(Block):
available block elements.

Section blocks can also optionally be given an "accessory,"
which is typically one of the interactive [Elements](/reference/elements).
which is typically one of the interactive
[Elements](/slackblocks/latest/reference/elements).

Args:
text: text to include in the block. Can be a string or `Text` object (of either
`mrkdwn` or `plaintext` variety). Defaults to markdown if unspecified. One of either
`text` or `fields` must be provided.
block_id: you can use this field to provide a deterministic identifier for the block.
fields: a list of text objects. One of either `text` or `fields` must be provided.
accessory: an optional [Element](/reference/elements) object that will take a
secondary place in the block (after or to the side of `text` or `fields`).
accessory: an optional [Element](/slackblocks/latest/reference/elements) object that
will take a secondary place in the block (after or to the side of `text` or
`fields`).

Throws:
InvalidUsageError: if any of the provided arguments fail validation checks.
Expand Down
42 changes: 22 additions & 20 deletions slackblocks/elements.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,11 @@ class CheckboxGroup(Element):
Args:
action_id: an identifier so the source of the action can be known.
options: a list of
[`Option`](/reference/objects/#objects.Option) objects that will form
the content of the checkbox group.
[`Option`](/slackblocks/latest/reference/objects/#objects.Option) objects that will
form the content of the checkbox group.
initial_options: a list of
[`Option`](/reference/objects/#objects.Option) objects that will be
initially selected when first presented to the user.
[`Option`](/slackblocks/latest/reference/objects/#objects.Option) objects that will
be initially selected when first presented to the user.
confirm: a `ConfirmationDialogue` object that will be presented when
the checkbox group is used.
focus_on_load: whether or not the checkbox group will be set to autofocus
Expand Down Expand Up @@ -423,7 +423,8 @@ class Image(Element):
alt_text: a plain-text-only summary of the content of the image.
image_url: a URL for a publicly hosted image (the user must provide
either `image_url` or `slack_file`).
slack_file: a [`SlackFile`](/reference/objects/#objects.SlackFile)
slack_file: a
[`SlackFile`](/slackblocks/latest/reference/objects/#objects.SlackFile)
(the user must provide either `image_url` or `slack_file`).

Throws:
Expand Down Expand Up @@ -465,14 +466,14 @@ class StaticMultiSelectMenu(Element):

Args:
action_id: an identifier so the source of the action can be known.
options: a list of [`Options`](/reference/objects/#objects.Option)
options: a list of [`Options`](/slackblocks/latest/reference/objects/#objects.Option)
(max 100). Only one of `options` or `option_groups` must be
provided.
option_groups: a list of
[`OptionGroups`](/reference/objects/#objects.OptionGroup)
[`OptionGroups`](/slackblocks/latest/reference/objects/#objects.OptionGroup)
(max 100). Only one of `options` or `option_groups` can be
provided.
initial_options: the [`Options`](/reference/objects/#objects.Option)
initial_options: the [`Options`](/slackblocks/latest/reference/objects/#objects.Option)
to be intially selected when the element is first rendered.
confirm: a `ConfirmationDialogue` object that will be presented when
the menu is used.
Expand Down Expand Up @@ -592,7 +593,7 @@ class ExternalMultiSelectMenu(Element):
action_id: an identifier so the source of the action can be known.
min_query_length: minimum number of characters entered before the query
is dispactched (defaults to 3 if not provided).
initial_options: the [`Options`](/reference/objects/#objects.Option)
initial_options: the [`Options`](/slackblocks/latest/reference/objects/#objects.Option)
to be intially selected when the element is first rendered.
confirm: a `ConfirmationDialogue` object that will be presented when
the menu is used.
Expand Down Expand Up @@ -729,7 +730,7 @@ class ConversationMultiSelectMenu(Element):
the menu is used.
max_selected_items: the maximum number of items that can be selected
in the menu.
filter: a [`Filter`](/reference/objects/#objects.ConversationFilter)
filter: a [`Filter`](/slackblocks/latest/reference/objects/#objects.ConversationFilter)
object that filters out conversations that don't match the settings
of the filter.
focus_on_load: whether or not the menu will be set to autofocus
Expand Down Expand Up @@ -952,7 +953,7 @@ class OverflowMenu(Element):
Args:
action_id: an identifier so the source of the action can be known.
options: a list of
[`Option`](/reference/objects/#objects.Option) objects that will form
[`Option`](/slackblocks/latest/reference/objects/#objects.Option) objects that will form
the content of the overflow menu.
confirm: a `ConfirmationDialogue` object that will be presented when an
option in the overflow menu is selected.
Expand Down Expand Up @@ -1064,10 +1065,10 @@ class RadioButtonGroup(Element):
Args:
action_id: an identifier so the source of the action can be known.
options: a list of
[`Option`](/reference/objects/#objects.Option) objects that will form
[`Option`](/slackblocks/latest/reference/objects/#objects.Option) objects that will form
the content of the radio button group.
initial_option: an
[`Option`](/reference/objects/#objects.Option) object that will be
[`Option`](/slackblocks/latest/reference/objects/#objects.Option) object that will be
initially selected when first presented to the user.
confirm: a `ConfirmationDialogue` object that will be presented when an
option in the overflow menu is selected.
Expand Down Expand Up @@ -1122,14 +1123,14 @@ class StaticSelectMenu(Element):
Args:
action_id: an identifier so the source of the action can be known.
options: a list of
[`Option`](/reference/objects/#objects.Option) objects that will form
[`Option`](/slackblocks/latest/reference/objects/#objects.Option) objects that will form
the content of the menu (max 100).
option_groups: a list of
[`OptionGroups`](/reference/objects/#objects.OptionGroup)
[`OptionGroups`](/slackblocks/latest/reference/objects/#objects.OptionGroup)
(max 100). Only one of `options` or `option_groups` can be
provided.
initial_option: an
[`Option`](/reference/objects/#objects.Option) object that will be
[`Option`](/slackblocks/latest/reference/objects/#objects.Option) object that will be
initially selected when first presented to the user.
confirm: a `ConfirmationDialogue` object that will be presented when an
option in the overflow menu is selected.
Expand Down Expand Up @@ -1225,12 +1226,13 @@ class ExternalSelectMenu(Element):
"""
A select menu interactive UI element, sourced with externally provided options.

See: <https://api.slack.com/reference/block-kit/block-elements#external_select>.
See:
<https://api.slack.com/slackblocks/latest/reference/block-kit/block-elements#external_select>. # noqa: E501

Args:
action_id: an identifier so the source of the action can be known.
initial_option: an
[`Option`](/reference/objects/#objects.Option) object that will be
[`Option`](/slackblocks/latest/reference/objects/#objects.Option) object that will be
initially selected when first presented to the user.
min_query_length: minimum number of characters entered before the query
is dispactched (defaults to 3 if not provided).
Expand Down Expand Up @@ -1355,7 +1357,7 @@ class ConversationSelectMenu(Element):
response_url_enabled: When set to true, the view_submission payload from the
menu's parent view will contain a response_url. (This response_url can be
used for message responses).
filter: a [`Filter`](/reference/objects/#objects.ConversationFilter)
filter: a [`Filter`](/slackblocks/latest/reference/objects/#objects.ConversationFilter)
object that filters out conversations that don't match the settings
of the filter.
focus_on_load: whether or not the input will be set to autofocus
Expand Down Expand Up @@ -1625,7 +1627,7 @@ class WorkflowButton(Element):

Args:
text: the text content that will appear in the button.
workflow: a [`Workflow`](/reference/objects/#objects.Workflow) object
workflow: a [`Workflow`](/slackblocks/latest/reference/objects/#objects.Workflow) object
that contains details about the workflow that will run when the
button is clicked.
style: one of `Default`, `Primary`, or `Danger`, determines the
Expand Down
10 changes: 5 additions & 5 deletions slackblocks/messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,10 @@ class Message(BaseMessage):
channel: the Slack channel to send the message to, e.g. "#general".
text: markdown text to send in the message. If `blocks` are provided
then this is a fallback to display in notifications.
blocks: a list of [`Blocks`](/reference/blocks) to form the contents
blocks: a list of [`Blocks`](/slackblocks/latest/reference/blocks) to form the contents
of the message instead of the contents of `text`.
attachments: a list of
[`Attachments`](/reference/attachments/#attachments.Attachment)
[`Attachments`](/slackblocks/latest/reference/attachments/#attachments.Attachment)
that form the secondary contents of the message (deprecated).
thread_ts: the timestamp ID of another unthreaded message that will
become the parent message of this message (now a reply in a thread).
Expand All @@ -114,7 +114,7 @@ class Message(BaseMessage):
automatically unfurl.
Throws:
InvalidUsageException: in the event that the items passed to `blocks`
are not valid [`Blocks`](/reference/blocks).
are not valid [`Blocks`](/slackblocks/latest/reference/blocks).
"""

def __init__(
Expand Down Expand Up @@ -184,9 +184,9 @@ class WebhookMessage:
text: markdown text to send in the message. If `blocks` are provided
then this is a fallback to display in notifications.
attachments: a list of
[`Attachments`](/reference/attachments/#attachments.Attachment)
[`Attachments`](/slackblocks/latest/reference/attachments/#attachments.Attachment)
that form the secondary contents of the message (deprecated).
blocks: a list of [`Blocks`](/reference/blocks) to form the contents
blocks: a list of [`Blocks`](/slackblocks/latest/reference/blocks) to form the contents
of the message instead of the contents of `text`.
response_type: one of `ResponseType.EPHEMERAL` or `ResponseType.IN_CHANNEL`.
Ephemeral messages are shown only to the requesting user whereas
Expand Down
3 changes: 2 additions & 1 deletion slackblocks/modals.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@

class Modal(ModalView):
"""
Kept for backwards compatibility - see [`ModalView`](/reference/views/#views.ModalView)
Kept for backwards compatibility - see
[`ModalView`](/slackblocks/latest/reference/views/#views.ModalView)
"""

def __repr__(self) -> str:
Expand Down
3 changes: 2 additions & 1 deletion slackblocks/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,8 @@ class Confirm(ConfirmationDialogue):
"""
Alias for `ConfirmationDialogue` to retain backwards compatibility.

See: [`ConfirmationDialogue`](/reference/objects/#objects.ConfirmationDialogue).
See:
[`ConfirmationDialogue`](/slackblocks/latest/reference/objects/#objects.ConfirmationDialogue). # noqa: E501
"""

def __init__(self, *args, **kwargs):
Expand Down
4 changes: 2 additions & 2 deletions slackblocks/rich_text/elements.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ def _resolve(self) -> Dict[str, Any]:
class RichTextUser(RichTextElement):
"""
Rich text element for representing users in
[`RichTextBlocks`](reference/blocks/#blocks.RichTextBlock).
[`RichTextBlocks`](/slackblocks/latest/reference/blocks/#blocks.RichTextBlock).

See: <https://api.slack.com/reference/block-kit/blocks#user-element-type>.

Expand Down Expand Up @@ -297,7 +297,7 @@ def _resolve(self) -> Dict[str, Any]:
class RichTextUserGroup(RichTextElement):
"""
Rich text element for representing groups of users in
[`RichTextBlocks`](reference/blocks/#blocks.RichTextBlock)`.
[`RichTextBlocks`](/slackblocks/latest/reference/blocks/#blocks.RichTextBlock)`.

See: <https://api.slack.com/reference/block-kit/blocks#user-element-type>.

Expand Down
6 changes: 3 additions & 3 deletions slackblocks/rich_text/objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class RichTextSection(RichTextObject):
"""
The most basic rich text container object, which takes rich text elements
and renders them when `RichTextSection` is passed to a
[`RichTextBlock`](/reference/blocks/#blocks.RichTextBlock).
[`RichTextBlock`](/slackblocks/latest/reference/blocks/#blocks.RichTextBlock).

See: <https://api.slack.com/reference/block-kit/blocks#rich_text_section>.

Expand Down Expand Up @@ -167,7 +167,7 @@ class RichTextCodeBlock(RichTextObject):

Args:
elements: one or more rich text primitive objexts
(e.g. [`RichText`](/reference/rich_text/#rich_text.RichText)).
(e.g. [`RichText`](/slackblocks/latest/reference/rich_text/#rich_text.RichText)).
border: the thickness (in pixels) of the border around the code block.

Throws:
Expand Down Expand Up @@ -213,7 +213,7 @@ class RichTextQuote(RichTextObject):

Args:
elements: one or more rich text primitive objexts
(e.g. [`RichText`](/reference/rich_text/#rich_text.RichText)).
(e.g. [`RichText`](/slackblocks/latest/reference/rich_text/#rich_text.RichText)).
border: the thickness (in pixels) of the border around the code block.
"""

Expand Down
Loading