|
| 1 | +# Video |
| 2 | + |
| 3 | +?> **Note:** This document is a reference to the `VideoBuilder` object in **Block Builder**. For more information on how this carries over to the Slack API, view the [the Video docs](https://api.slack.com/reference/block-kit/blocks#video) on Slack's doc site. |
| 4 | + |
| 5 | +### Creating an Instance |
| 6 | + |
| 7 | +The function that creates a new instance of `VideoBuilder` is available as both a top-level import and as a member of its 'category', `Blocks`: |
| 8 | + |
| 9 | +```javascript |
| 10 | +import { Video } from 'slack-block-builder'; |
| 11 | + |
| 12 | +const myObj = Video(params?); |
| 13 | + |
| 14 | +``` |
| 15 | +
|
| 16 | +```javascript |
| 17 | +import { Blocks } from 'slack-block-builder'; |
| 18 | + |
| 19 | +const myObj = Blocks.Video(params?); |
| 20 | +``` |
| 21 | +
|
| 22 | +### Params |
| 23 | +
|
| 24 | +Each instance of the `VideoBuilder` object has chainable setter methods for the object's properties. However, properties with primitive values can optionally be passed to the instantiating function, should you prefer: |
| 25 | +
|
| 26 | +`blockId` – *String* |
| 27 | +
|
| 28 | +`description` – *String* |
| 29 | +
|
| 30 | +`providerIconUrl` – *String* |
| 31 | +
|
| 32 | +`providerName` – *String* |
| 33 | +
|
| 34 | +`thumbnailUrl` – *String* |
| 35 | +
|
| 36 | +`title` – *String* |
| 37 | +
|
| 38 | +`titleUrl` – *String* |
| 39 | +
|
| 40 | +`videoUrl` – *String* |
| 41 | +
|
| 42 | +
|
| 43 | +?> **Note:** For an explanation of any one of the parameters, see its corresponding setter method below. |
| 44 | +
|
| 45 | +### Setter Methods |
| 46 | +
|
| 47 | +All setter methods return `this`, the instance of `VideoBuilder` on which it is called. |
| 48 | +
|
| 49 | +```javascript |
| 50 | +VideoBuilder.altText(string); |
| 51 | +``` |
| 52 | +
|
| 53 | +This a plain-text summary of the image element or block. |
| 54 | +```javascript |
| 55 | +VideoBuilder.authorName(string); |
| 56 | +``` |
| 57 | +
|
| 58 | +This a plain-text representation of the author of a video. |
| 59 | +```javascript |
| 60 | +VideoBuilder.blockId(string); |
| 61 | +``` |
| 62 | +
|
| 63 | +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. |
| 64 | +```javascript |
| 65 | +VideoBuilder.description(string); |
| 66 | +``` |
| 67 | +
|
| 68 | +Sets the descriptive text displayed below the text field of the option or for a video, if creating a Video block. |
| 69 | +```javascript |
| 70 | +VideoBuilder.providerIconUrl(string); |
| 71 | +``` |
| 72 | +
|
| 73 | +Icon for the video provider - ex. YouTube or Vimeo icon. |
| 74 | +```javascript |
| 75 | +VideoBuilder.providerName(string); |
| 76 | +``` |
| 77 | +
|
| 78 | +The originating application or domain of the video ex. YouTube or Vimeo. |
| 79 | +```javascript |
| 80 | +VideoBuilder.thumbnailUrl(string); |
| 81 | +``` |
| 82 | +
|
| 83 | +A URL that loads the thumbnail image of the video. |
| 84 | +```javascript |
| 85 | +VideoBuilder.title(string); |
| 86 | +``` |
| 87 | +
|
| 88 | +Sets the title displayed for the block, element, or confirmation dialog. |
| 89 | +```javascript |
| 90 | +VideoBuilder.titleUrl(string); |
| 91 | +``` |
| 92 | +
|
| 93 | +A hyperlink for the video's title text. |
| 94 | +```javascript |
| 95 | +VideoBuilder.videoUrl(string); |
| 96 | +``` |
| 97 | +
|
| 98 | +The URL of the video to embed in the Video block. |
| 99 | +
|
| 100 | +### Other Methods |
| 101 | +
|
| 102 | +The `VideoBuilder` object also has other methods available: |
| 103 | +
|
| 104 | +```javascript |
| 105 | +VideoBuilder.end(); |
| 106 | +``` |
| 107 | +
|
| 108 | +Performs no alterations to the object on which it is called. It is meant to simulate a closing HTML tag for those who prefer to have an explicit end declared for an object. |
0 commit comments