slackapi / deno-slack-sdk

SDK for building Run on Slack apps using Deno
https://api.slack.com/automation
MIT License
155 stars 27 forks source link

Add new Canvas built in functions to the deno-sdk #273

Closed rafaelamsili closed 6 months ago

rafaelamsili commented 6 months ago

Summary

This PR add the new deno-sdk built in Slack functions for canvas

Also adds new primitives types:

Notes

Requirements

Manifest

In order to use the Canvas deno-sdk function its required to enable appHome and set messagesTabEnabled to true and messagesTabReadOnlyEnabled to false. This is required since Canvas Sharing require sending messages in order to Share and transfer ownership of canvases

 features: {
    appHome: {
      messagesTabEnabled: true,
      messagesTabReadOnlyEnabled: false,
    },
  },

Create Canvas

For creating a canvas a user will need to set the canvas_create_type to blank or template, it defaults to blank is if not passed. In case that template is set then the user will have to provide canvas_template_id, in which case the canvas will copy the template to the newly created standalone canvas

Create Channel Canvas

For creating a channels canvas a user will need to set the canvas_create_type to blank or template, it defaults to blank is if not passed. In case that template is set then the user will have to provide canvas_template_id, in which case the canvas will copy the template to the newly created channel canvas

Update Canvas Content

For updating the canvas content the canvas_update_type will determine if the user want to update a standalone canvas or a channel canvas, by default if is not set it will be treated as standalone. If the user set standalone then a canvas_id need to be provided, otherwise if the user set channel_canvas it will need to provide a channel_id of the channel canvas that the user want to update.

If the user set the section_id then the content will be updated to the top of bottom of the section, this is the section_id of the heading sections, otherwise if is not set the content will be updated to the top or bottom of the canvas

Testing

Create an app using the functions and see that it perform the actions

codecov[bot] commented 6 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 98.35%. Comparing base (9de72ce) to head (e47b971).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #273 +/- ## ========================================== + Coverage 98.15% 98.35% +0.19% ========================================== Files 58 63 +5 Lines 2282 2552 +270 Branches 147 147 ========================================== + Hits 2240 2510 +270 Misses 42 42 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.