Skip to content

v0.0.2 - Result Builder API

Latest

Choose a tag to compare

@github-actions github-actions released this 04 Feb 14:10
· 1 commit to main since this release
7b5bc41

🎨 Result Builder API

This release introduces a Swifty result builder API for constructing Mattermost messages declaratively, making the code more readable and maintainable.

✨ Features

  • Result Builder Syntax: Build messages, attachments, and props using a clean, declarative syntax
  • Type-Safe Builders: Compile-time safety with Swift 6 strict concurrency
  • Fluent API: Chain properties naturally with intuitive naming
  • Comprehensive: Covers all message components including text, username, icon, attachments, fields, actions, confirmations, props, and priority

📝 Example

let message = Message {
    "Deployment completed successfully 🚀"
    Username("DeployBot")
    IconEmoji(":rocket:")
    
    Attachment {
        "Good news! Your deployment is complete."
        Color("#36a64f")
        
        Field("Environment", "production")
        Field("Duration", "2m 15s")
        Field("Status", "Success").short()
        
        Action("View Logs", "https://example.com/logs").primary()
        Action("Rollback", "https://example.com/rollback").danger()
    }
}

🧪 Testing

  • New comprehensive integration tests
  • Result builder test coverage for all components
  • Verified against actual Mattermost webhook responses

📦 What's Changed

  • Add Message+Builder.swift - Result builder for messages
  • Add Attachment+Builder.swift - Result builder for attachments
  • Add Confirmation+Builder.swift - Result builder for action confirmations
  • Add Props+Builder.swift - Result builder for Mattermost props
  • Add AttachmentBuilderTests.swift - Unit tests for attachment builders
  • Add MattermostKitIntegrationTests.swift - Full integration test suite
  • Update README with result builder examples

Swift Version: 6.2+
Platforms: macOS 12.0+, iOS 15.0+, tvOS 15.0+, watchOS 8.0+