slack-block-builder
Version:
Maintainable code for interactive Slack messages, modals, home tabs, and workflow steps. A must-have for the Slack Block Kit framework.
134 lines (133 loc) • 6.81 kB
JavaScript
;
/* eslint-disable max-len */
Object.defineProperty(exports, "__esModule", { value: true });
exports.Blocks = exports.Video = exports.Section = exports.Input = exports.Image = exports.Header = exports.File = exports.Divider = exports.Context = exports.Actions = void 0;
const actions_1 = require("./actions");
const context_1 = require("./context");
const divider_1 = require("./divider");
const file_1 = require("./file");
const header_1 = require("./header");
const image_1 = require("./image");
const input_1 = require("./input");
const section_1 = require("./section");
const video_1 = require("./video");
/**
* Functions here do not use arrow functions stored in variables for IDE color compatibility.
*/
/**
* @param {Object} [params] Parameters passed to the constructor.
* @param {string} [params.blockId] Sets a string to be an identifier for any given block in a view or message. This is sent back to your app in interaction payloads and view submissions for your app to process.
*
* {@link https://api.slack.com/reference/block-kit/blocks#actions|View in Slack API Documentation}
*/
function Actions(params) {
return new actions_1.ActionsBuilder(params);
}
exports.Actions = Actions;
/**
* @param {Object} [params] Parameters passed to the constructor.
* @param {string} [params.blockId] Sets a string to be an identifier for any given block in a view or message. This is sent back to your app in interaction payloads and view submissions for your app to process.
*
* {@link https://api.slack.com/reference/block-kit/blocks#context|View in Slack API Documentation}
*/
function Context(params) {
return new context_1.ContextBuilder(params);
}
exports.Context = Context;
/**
* @param {Object} [params] Parameters passed to the constructor.
* @param {string} [params.blockId] Sets a string to be an identifier for any given block in a view or message. This is sent back to your app in interaction payloads and view submissions for your app to process.
*
* {@link https://api.slack.com/reference/block-kit/blocks#divider|View in Slack API Documentation}
*/
function Divider(params) {
return new divider_1.DividerBuilder(params);
}
exports.Divider = Divider;
/**
* @param {Object} [params] Parameters passed to the constructor.
* @param {string} [params.blockId] Sets a string to be an identifier for any given block in a view or message. This is sent back to your app in interaction payloads and view submissions for your app to process.
* @param {string} [params.externalId] Sets a custom identifier for the file that must be unique for all images on a per-team basis.
*
* {@link https://api.slack.com/reference/block-kit/blocks#file|View in Slack API Documentation}
*/
function File(params) {
return new file_1.FileBuilder(params);
}
exports.File = File;
/**
* @param {Object} [params] Parameters passed to the constructor.
* @param {string} [params.blockId] Sets a string to be an identifier for any given block in a view or message. This is sent back to your app in interaction payloads and view submissions for your app to process.
* @param {string} [params.text] Sets the text to be displayed in the header block.
*
* {@link https://api.slack.com/reference/block-kit/blocks#header|View in Slack API Documentation}
*/
function Header(params) {
return new header_1.HeaderBuilder(params);
}
exports.Header = Header;
/**
* @param {Object} [params] Parameters passed to the constructor.
* @param {string} [params.blockId] Sets a string to be an identifier for any given block in a view or message. This is sent back to your app in interaction payloads and view submissions for your app to process.
* @param {string} [params.imageUrl] Sets the source URL from which the image will be loaded.
* @param {string} [params.altText] Sets a textual summary for the image.
* @param {string} [params.title] Sets an optional title for the image.
*
* {@link https://api.slack.com/reference/block-kit/blocks#image|View in Slack API Documentation}
*/
function Image(params) {
return new image_1.ImageBuilder(params);
}
exports.Image = Image;
/**
* @param {Object} [params] Parameters passed to the constructor.
* @param {string} [params.blockId] Sets a string to be an identifier for any given block in a view or message. This is sent back to your app in interaction payloads and view submissions for your app to process.
* @param {string} [params.label] Sets the label to be displayed above the input.
* @param {string} [params.hint] Sets the hint to be displayed under the input.
*
* {@link https://api.slack.com/reference/block-kit/blocks#input|View in Slack API Documentation}
*/
function Input(params) {
return new input_1.InputBuilder(params);
}
exports.Input = Input;
/**
* @param {Object} [params] Parameters passed to the constructor.
* @param {string} [params.blockId] Sets a string to be an identifier for the block, that will be available in interaction payloadsSets a string to be an identifier for any given block in a view or message. This is sent back to your app in interaction payloads and view submissions for your app to process.
* @param {string} [params.text] Sets the text to be displayed in the section block.
*
* {@link https://api.slack.com/reference/block-kit/blocks#section|View in Slack API Documentation}
*/
function Section(params) {
return new section_1.SectionBuilder(params);
}
exports.Section = Section;
/**
* @param {Object} [params] Parameters passed to the constructor.
* @param {string} [params.blockId] Sets a string to be an identifier for the block, that will be available in interaction payloadsSets a string to be an identifier for any given block in a view or message. This is sent back to your app in interaction payloads and view submissions for your app to process.
* @param {string} [params.description] Sets a description for the video.
* @param {string} [params.providerIconUrl] Icon for the video provider - ex. YouTube or Vimeo icon.
* @param {string} [params.providerName] The originating application or domain of the video ex. YouTube or Vimeo.
* @param {string} [params.thumbnailUrl] A URL that loads the thumbnail image of the video.
* @param {string} [params.title] Sets the title displayed for the block, element, or confirmation dialog.
* @param {string} [params.titleUrl] A hyperlink for the video's title text.
* @param {string} [params.videoUrl] The URL of the video to embed in the Video block.
*
* {@link https://api.slack.com/reference/block-kit/blocks#section|View in Slack API Documentation}
*/
function Video(params) {
return new video_1.VideoBuilder(params);
}
exports.Video = Video;
const blocks = {
Actions,
Context,
Divider,
File,
Header,
Image,
Input,
Section,
Video,
};
exports.Blocks = blocks;