fun slackMessageBlocks()

in space-slack-sync/src/main/kotlin/org/jetbrains/spaceSlackSync/space/Utils.kt [134:156]


fun slackMessageBlocks(
    messageText: String,
    spaceAttachments: List<SpaceAttachment>
) = withBlocks {
    section {
        text(MarkdownTextObject.TYPE, messageText)
    }
    spaceAttachments.forEach { spaceAttachment ->
        when (spaceAttachment) {
            is SpaceAttachment.ImageAttachment -> {
                image {
                    title(spaceAttachment.name)
                    imageUrl(spaceAttachment.publicImageUrl)
                    altText("")
                }
            }

            is SpaceAttachment.FileAttachment -> {
                file(externalId = spaceAttachment.slackExternalId, source = FileSource.REMOTE)
            }
        }
    }
}