Add Result Builder API for declarative message construction#1
Merged
Conversation
Follows SlackKit's architecture pattern with TypeName+Builder.swift files: Message+Builder.swift: - @AttachmentBuilder for building attachment arrays - Message extension with result builder initializer - Attachment extension with field builder initializer Attachment+Builder.swift: - @FieldBuilder for building field arrays - @ActionBuilder for building action arrays - Extension initializers for Attachment - Convenience functions: Field(), Button() Props+Builder.swift: - @PropsBuilder for constructing dynamic property dictionaries - Props initializer with result builder - Property() convenience functions for all AnyCodable types Confirmation+Builder.swift: - @ConfirmationBuilder for building confirmation dialogs - Confirmation initializer with result builder - ConfirmButton() and DenyButton() convenience functions README.md: - Updated to showcase only the Result Builder API - Added Props and Confirmation builder examples - Updated Builder API Reference section 20 comprehensive tests for result builder functionality. All 33 tests passing.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e4171e6d9e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
- Props+Builder: Store builder result once to avoid double evaluation which could cause inconsistent results or duplicate side effects - Confirmation+Builder: Add buildArray() to enable for-in loop support - Confirmation+Builder: Fix unused variable warning for style parameter
20a384d to
b2ccc4e
Compare
Adds end-to-end integration tests that send actual messages to Mattermost via Incoming Webhooks. Tests cover all major features including text messages, attachments, actions, builder API, priority, props, and special characters. Tests are disabled by default and only run when MATTERMOST_INTEGRATION_TESTS environment variable is set.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds a result builder API for declarative message construction and comprehensive integration tests for end-to-end verification.
Result Builder API
Following SlackKit's architecture pattern, all builders use Swift's
@resultBuilderattribute for clean, type-safe DSL syntax.New Builder Files
@AttachmentBuilderfor building attachment arrays@FieldBuilderand@ActionBuilderfor fields and actions@PropsBuilderfor dynamic properties@ConfirmationBuilderfor confirmation dialogsKey Features
Message Builder: Declarative attachment construction
Props Builder: Dynamic properties with type-safe convenience functions
Confirmation Builder: Custom button configurations
Conditional Logic: Native if/else and for-in support
Convenience Functions:
Field(),Button(),Property(),ConfirmButton(),DenyButton()Integration Tests
Added comprehensive end-to-end integration tests that send actual messages to Mattermost via Incoming Webhooks.
Test Coverage (47 tests)
Running Integration Tests
Tests are disabled by default. Set environment variables to run:
All tests are serialized with delays between requests to avoid rate limits.
Documentation Updates
Test plan