From f58fa8cab8f4e000eba2caa67fc54729dec8a3ac Mon Sep 17 00:00:00 2001 From: Nicholas Lambourne Date: Fri, 5 Jul 2024 20:08:48 +1000 Subject: [PATCH] avoid docs issue regressions and merge conflicts --- docs_src/index.md | 28 ------------ slackblocks/attachments.py | 4 -- slackblocks/blocks.py | 32 ++------------ slackblocks/elements.py | 72 ++----------------------------- slackblocks/messages.py | 17 -------- slackblocks/modals.py | 4 -- slackblocks/objects.py | 6 +-- slackblocks/rich_text/__init__.py | 2 +- slackblocks/rich_text/elements.py | 4 +- slackblocks/rich_text/objects.py | 4 +- 10 files changed, 12 insertions(+), 161 deletions(-) diff --git a/docs_src/index.md b/docs_src/index.md index 4480243..959246e 100644 --- a/docs_src/index.md +++ b/docs_src/index.md @@ -20,7 +20,6 @@ The [Slack BlockKit API](https://api.slack.com/block-kit) defines a number of classes that represent these resources. ### Objects -<<<<<<< Updated upstream [`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`](/slackblocks/latest/reference/elements) and [`Blocks`](/slackblocks/latest/reference/blocks). @@ -38,43 +37,16 @@ The [Slack BlockKit API](https://api.slack.com/block-kit) defines a number of elements. For example, the [`DividerBlock`](/slackblocks/latest/reference/blocks/#blocks.DividerBlock), when rendered, will show a visual element similar to a `
` HTML element. The [`RichTextBlock`](/slackblocks/latest/reference/blocks/#blocks.RichTextBlock) on the other hand -======= -[`Objects`](/slackblocks/reference/objects) (e.g. [`Text`](/slackblocks/reference/objects/#objects.Text)) - are the lowest level pimitives that are used to populate - [`Elements`](/slackblocks/reference/elements) and [`Blocks`](/slackblocks/reference/blocks). - -### Elements -[`Elements`](/slackblocks/reference/elements) are typically interactive UI elements that take - in [`Object`](/slackblocks/reference/objects) to define their content. For example, the - [`CheckboxGroup`](/elements/#elements.CheckboxGroup) element takes in one or - more [`Option`](/slackblocks/reference/objects/#objects.Option) items and presents a - checkbox menu to the user with those options. - -### Blocks -[`Blocks`](/slackblocks/reference/blocks) are the core element of the API, with different - [`Blocks`](/slackblocks/reference/blocks) used to create different types of visual - elements. For example, the [`DividerBlock`](/slackblocks/reference/blocks/#blocks.DividerBlock), - when rendered, will show a visual element similar to a `
` HTML element. The - [`RichTextBlock`](/slackblocks/reference/blocks/#blocks.RichTextBlock) on the other hand ->>>>>>> Stashed changes allows for the display of text elements with visual styling like italics, block quotes, lists and code blocks. ### Messages -<<<<<<< Updated upstream [`Messages`](/slackblocks/latest/reference/messages/) are a convenience wrapper around `Blocks` that -======= -[`Messages`](/slackblocks/reference/messages/) are a convenience wrapper around `Blocks` that ->>>>>>> Stashed changes can be unpacked as arguments straight into the official Slack Python SDK (or its legacy `slackclient` counterpart). ### Views -<<<<<<< Updated upstream [`Views`](reference/views/) are an alternative usage for [`Blocks`](/slackblocks/latest/reference/blocks) -======= -[`Views`](reference/views/) are an alternative usage for [`Blocks`](/slackblocks/reference/blocks) ->>>>>>> Stashed changes that allow for the creation of custom UI "surfaces" within Slack, e.g. for third-party apps. diff --git a/slackblocks/attachments.py b/slackblocks/attachments.py index fc61d73..6e8b928 100644 --- a/slackblocks/attachments.py +++ b/slackblocks/attachments.py @@ -19,11 +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 -<<<<<<< Updated upstream [`Attachment`](/slackblocks/latest/reference/attachments/#attachments.Attachment). -======= - [`Attachment`](/slackblocks/reference/attachments/#attachments.Attachment). ->>>>>>> Stashed changes diff --git a/slackblocks/blocks.py b/slackblocks/blocks.py index e32f973..4cdf3b1 100644 --- a/slackblocks/blocks.py +++ b/slackblocks/blocks.py @@ -116,12 +116,8 @@ class ActionsBlock(Block): A `Block` that is used to hold interactive elements (normally for users to interface with). Args: -<<<<<<< Updated upstream elements: a list of [Elements](/slackblocks/latest/reference/elements) (up to a maximum of 25). -======= - elements: a list of [Elements](/slackblocks/reference/elements) (up to a maximum of 25). ->>>>>>> Stashed changes block_id: you can use this field to provide a deterministic identifier for the block. Throws: @@ -311,16 +307,10 @@ class InputBlock(Block): Args: label: the name which identifies the input field. -<<<<<<< Updated upstream 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. -======= - element: an interactive [Element](/slackblocks/reference/elements) (e.g. a text field). - dispatch_action: whether the [Element](/slackblocks/reference/elements) should trigger the - sending of a `block_actions` payload. ->>>>>>> Stashed changes 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. @@ -368,17 +358,10 @@ class RichTextBlock(Block): """ A RichTextBlock is used to provide easier rich text formatting than standard markdown text (e.g. in a -<<<<<<< Updated upstream [`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](/slackblocks/latest/reference/rich_text). -======= - [`SectionBlock`](/slackblocks/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](/slackblocks/reference/rich_text). ->>>>>>> Stashed changes Args: elements: a single [rich text element](rich_text) @@ -421,12 +404,8 @@ class SectionBlock(Block): available block elements. Section blocks can also optionally be given an "accessory," -<<<<<<< Updated upstream which is typically one of the interactive [Elements](/slackblocks/latest/reference/elements). -======= - which is typically one of the interactive [Elements](/slackblocks/reference/elements). ->>>>>>> Stashed changes Args: text: text to include in the block. Can be a string or `Text` object (of either @@ -434,14 +413,9 @@ class SectionBlock(Block): `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. -<<<<<<< Updated upstream - 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`). -======= - accessory: an optional [Element](/slackblocks/reference/elements) object that will take a - secondary place in the block (after or to the side of `text` or `fields`). ->>>>>>> Stashed changes + 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. diff --git a/slackblocks/elements.py b/slackblocks/elements.py index cbbf189..3cff8f8 100644 --- a/slackblocks/elements.py +++ b/slackblocks/elements.py @@ -165,19 +165,11 @@ class CheckboxGroup(Element): Args: action_id: an identifier so the source of the action can be known. options: a list of -<<<<<<< Updated upstream - [`Option`](/slackblocks/latest/reference/objects/#objects.Option) objects that will - form the content of the checkbox group. - initial_options: a list of - [`Option`](/slackblocks/latest/reference/objects/#objects.Option) objects that will - be initially selected when first presented to the user. -======= - [`Option`](/slackblocks/reference/objects/#objects.Option) objects that will form + [`Option`](/slackblocks/latest/reference/objects/#objects.Option) objects that will form the content of the checkbox group. initial_options: a list of - [`Option`](/slackblocks/reference/objects/#objects.Option) objects that will be + [`Option`](/slackblocks/latest/reference/objects/#objects.Option) objects that will be initially selected when first presented to the user. ->>>>>>> Stashed changes 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 @@ -431,12 +423,7 @@ 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`). -<<<<<<< Updated upstream - slack_file: a - [`SlackFile`](/slackblocks/latest/reference/objects/#objects.SlackFile) -======= - slack_file: a [`SlackFile`](/slackblocks/reference/objects/#objects.SlackFile) ->>>>>>> Stashed changes + slack_file: a [`SlackFile`](/slackblocks/latest/reference/objects/#objects.SlackFile) (the user must provide either `image_url` or `slack_file`). Throws: @@ -478,7 +465,6 @@ class StaticMultiSelectMenu(Element): Args: action_id: an identifier so the source of the action can be known. -<<<<<<< Updated upstream options: a list of [`Options`](/slackblocks/latest/reference/objects/#objects.Option) (max 100). Only one of `options` or `option_groups` must be provided. @@ -487,16 +473,6 @@ class StaticMultiSelectMenu(Element): (max 100). Only one of `options` or `option_groups` can be provided. initial_options: the [`Options`](/slackblocks/latest/reference/objects/#objects.Option) -======= - options: a list of [`Options`](/slackblocks/reference/objects/#objects.Option) - (max 100). Only one of `options` or `option_groups` must be - provided. - option_groups: a list of - [`OptionGroups`](/slackblocks/reference/objects/#objects.OptionGroup) - (max 100). Only one of `options` or `option_groups` can be - provided. - initial_options: the [`Options`](/slackblocks/reference/objects/#objects.Option) ->>>>>>> Stashed changes to be intially selected when the element is first rendered. confirm: a `ConfirmationDialogue` object that will be presented when the menu is used. @@ -616,11 +592,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). -<<<<<<< Updated upstream initial_options: the [`Options`](/slackblocks/latest/reference/objects/#objects.Option) -======= - initial_options: the [`Options`](/slackblocks/reference/objects/#objects.Option) ->>>>>>> Stashed changes to be intially selected when the element is first rendered. confirm: a `ConfirmationDialogue` object that will be presented when the menu is used. @@ -757,11 +729,7 @@ class ConversationMultiSelectMenu(Element): the menu is used. max_selected_items: the maximum number of items that can be selected in the menu. -<<<<<<< Updated upstream filter: a [`Filter`](/slackblocks/latest/reference/objects/#objects.ConversationFilter) -======= - filter: a [`Filter`](/slackblocks/reference/objects/#objects.ConversationFilter) ->>>>>>> Stashed changes 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 @@ -984,11 +952,7 @@ class OverflowMenu(Element): Args: action_id: an identifier so the source of the action can be known. options: a list of -<<<<<<< Updated upstream [`Option`](/slackblocks/latest/reference/objects/#objects.Option) objects that will form -======= - [`Option`](/slackblocks/reference/objects/#objects.Option) objects that will form ->>>>>>> Stashed changes the content of the overflow menu. confirm: a `ConfirmationDialogue` object that will be presented when an option in the overflow menu is selected. @@ -1100,17 +1064,10 @@ class RadioButtonGroup(Element): Args: action_id: an identifier so the source of the action can be known. options: a list of -<<<<<<< Updated upstream [`Option`](/slackblocks/latest/reference/objects/#objects.Option) objects that will form the content of the radio button group. initial_option: an [`Option`](/slackblocks/latest/reference/objects/#objects.Option) object that will be -======= - [`Option`](/slackblocks/reference/objects/#objects.Option) objects that will form - the content of the radio button group. - initial_option: an - [`Option`](/slackblocks/reference/objects/#objects.Option) object that will be ->>>>>>> Stashed changes 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. @@ -1165,7 +1122,6 @@ class StaticSelectMenu(Element): Args: action_id: an identifier so the source of the action can be known. options: a list of -<<<<<<< Updated upstream [`Option`](/slackblocks/latest/reference/objects/#objects.Option) objects that will form the content of the menu (max 100). option_groups: a list of @@ -1174,16 +1130,6 @@ class StaticSelectMenu(Element): provided. initial_option: an [`Option`](/slackblocks/latest/reference/objects/#objects.Option) object that will be -======= - [`Option`](/slackblocks/reference/objects/#objects.Option) objects that will form - the content of the menu (max 100). - option_groups: a list of - [`OptionGroups`](/slackblocks/reference/objects/#objects.OptionGroup) - (max 100). Only one of `options` or `option_groups` can be - provided. - initial_option: an - [`Option`](/slackblocks/reference/objects/#objects.Option) object that will be ->>>>>>> Stashed changes 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. @@ -1285,11 +1231,7 @@ class ExternalSelectMenu(Element): Args: action_id: an identifier so the source of the action can be known. initial_option: an -<<<<<<< Updated upstream [`Option`](/slackblocks/latest/reference/objects/#objects.Option) object that will be -======= - [`Option`](/slackblocks/reference/objects/#objects.Option) object that will be ->>>>>>> Stashed changes 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). @@ -1414,11 +1356,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). -<<<<<<< Updated upstream filter: a [`Filter`](/slackblocks/latest/reference/objects/#objects.ConversationFilter) -======= - filter: a [`Filter`](/slackblocks/reference/objects/#objects.ConversationFilter) ->>>>>>> Stashed changes 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 @@ -1688,11 +1626,7 @@ class WorkflowButton(Element): Args: text: the text content that will appear in the button. -<<<<<<< Updated upstream workflow: a [`Workflow`](/slackblocks/latest/reference/objects/#objects.Workflow) object -======= - workflow: a [`Workflow`](/slackblocks/reference/objects/#objects.Workflow) object ->>>>>>> Stashed changes that contains details about the workflow that will run when the button is clicked. style: one of `Default`, `Primary`, or `Danger`, determines the diff --git a/slackblocks/messages.py b/slackblocks/messages.py index 70ac22e..cb08d03 100644 --- a/slackblocks/messages.py +++ b/slackblocks/messages.py @@ -99,17 +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. -<<<<<<< Updated upstream 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`](/slackblocks/latest/reference/attachments/#attachments.Attachment) -======= - blocks: a list of [`Blocks`](/slackblocks/reference/blocks) to form the contents - of the message instead of the contents of `text`. - attachments: a list of - [`Attachments`](/slackblocks/reference/attachments/#attachments.Attachment) ->>>>>>> Stashed changes 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). @@ -121,11 +114,7 @@ class Message(BaseMessage): automatically unfurl. Throws: InvalidUsageException: in the event that the items passed to `blocks` -<<<<<<< Updated upstream are not valid [`Blocks`](/slackblocks/latest/reference/blocks). -======= - are not valid [`Blocks`](/slackblocks/reference/blocks). ->>>>>>> Stashed changes """ def __init__( @@ -195,15 +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 -<<<<<<< Updated upstream [`Attachments`](/slackblocks/latest/reference/attachments/#attachments.Attachment) that form the secondary contents of the message (deprecated). blocks: a list of [`Blocks`](/slackblocks/latest/reference/blocks) to form the contents -======= - [`Attachments`](/slackblocks/reference/attachments/#attachments.Attachment) - that form the secondary contents of the message (deprecated). - blocks: a list of [`Blocks`](/slackblocks/reference/blocks) to form the contents ->>>>>>> Stashed changes 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 diff --git a/slackblocks/modals.py b/slackblocks/modals.py index d4907e9..15947fd 100644 --- a/slackblocks/modals.py +++ b/slackblocks/modals.py @@ -16,12 +16,8 @@ class Modal(ModalView): """ -<<<<<<< Updated upstream Kept for backwards compatibility - see [`ModalView`](/slackblocks/latest/reference/views/#views.ModalView) -======= - Kept for backwards compatibility - see [`ModalView`](/slackblocks/reference/views/#views.ModalView) ->>>>>>> Stashed changes """ def __repr__(self) -> str: diff --git a/slackblocks/objects.py b/slackblocks/objects.py index 1c1e7a8..fff0537 100644 --- a/slackblocks/objects.py +++ b/slackblocks/objects.py @@ -221,12 +221,8 @@ class Confirm(ConfirmationDialogue): """ Alias for `ConfirmationDialogue` to retain backwards compatibility. -<<<<<<< Updated upstream See: - [`ConfirmationDialogue`](/slackblocks/latest/reference/objects/#objects.ConfirmationDialogue). # noqa: E501 -======= - See: [`ConfirmationDialogue`](/slackblocks/reference/objects/#objects.ConfirmationDialogue). ->>>>>>> Stashed changes + [`ConfirmationDialogue`](/slackblocks/latest/reference/objects/#objects.ConfirmationDialogue). """ def __init__(self, *args, **kwargs): diff --git a/slackblocks/rich_text/__init__.py b/slackblocks/rich_text/__init__.py index 70124c4..fe11fac 100644 --- a/slackblocks/rich_text/__init__.py +++ b/slackblocks/rich_text/__init__.py @@ -4,7 +4,7 @@ available in traditional markdown like strikethrough). These formatting elements can only be used within a -[`RichTextBlock`](../blocks/#blocks.RichTextBlock). +[`RichTextBlock`](/slackblocks/reference/blocks/#blocks.RichTextBlock). See: . """ diff --git a/slackblocks/rich_text/elements.py b/slackblocks/rich_text/elements.py index ce6ea98..94197ed 100644 --- a/slackblocks/rich_text/elements.py +++ b/slackblocks/rich_text/elements.py @@ -1,7 +1,7 @@ """ Rich text elements are the primitive elements used to populate the rich text object "containers", which are then fed into the - [`RichTextBlock`](../blocks/#blocks.RichTextBlock). + [`RichTextBlock`](/slackblocks/latest/reference/blocks/#blocks.RichTextBlock). """ from abc import ABC, abstractmethod @@ -30,7 +30,7 @@ class RichTextElement(ABC): Abstract base class for all rich text element classes. These are the primitives that form the basis of rich text objects and - the [`RichTextBlock`](../blocks/#blocks.RichTextBlock). + the [`RichTextBlock`](/slackblocks/latest/reference/blocks/#blocks.RichTextBlock). """ def __init__(self, type_: RichTextElementType) -> None: diff --git a/slackblocks/rich_text/objects.py b/slackblocks/rich_text/objects.py index a71d8d7..6c1988c 100644 --- a/slackblocks/rich_text/objects.py +++ b/slackblocks/rich_text/objects.py @@ -2,7 +2,7 @@ Rich text objects are containers for rich text elements. These obejects form the contents of the - [`RichTextBlock`](../blocks/#blocks.RichTextBlock). + [`RichTextBlock`](/slackblocks/latest/reference/blocks/#blocks.RichTextBlock). """ from abc import ABC, abstractmethod @@ -159,7 +159,7 @@ def _resolve(self) -> Dict[str, Any]: class RichTextCodeBlock(RichTextObject): """ A rich text element for representing blocks of code in - [`RichTextBlocks`](reference/blocks/#blocks.RichTextBlock). + [`RichTextBlocks`](/slackblocks/latest/reference/blocks/#blocks.RichTextBlock). This is roughly equivalent to the triple-backtick \`\`\``code`\`\`\` syntax in markdown.