UNPKG

3.54 kBTypeScriptView Raw
1import type { OptionalArgument } from '../helpers';
2import type { ChannelID, ChannelIDs, TokenOverridable, UserIDs } from './common';
3interface CanvasID {
4 /** @description Encoded ID of the canvas. */
5 canvas_id: string;
6}
7export interface DocumentContent {
8 /** @description The type of content used to describe Canvas content. Always is `markdown`. */
9 type: 'markdown';
10 /** @description The markdown defining the Canvas content. */
11 markdown: string;
12}
13type SectionType = 'any_header' | 'h1' | 'h2' | 'h3';
14interface SectionTypes {
15 /** @description List of desired section types to filter on. Minimum of 1, maximum of 3. */
16 section_types: [SectionType, ...SectionType[]];
17}
18interface ContainsText {
19 /** @description Textual content that must appear in the section. */
20 contains_text: string;
21}
22type Criteria = (SectionTypes & Partial<ContainsText>) | (Partial<SectionTypes> & ContainsText);
23type Operation = 'insert_after' | 'insert_before' | 'insert_at_start' | 'insert_at_end' | 'replace' | 'delete';
24interface BaseChange {
25 /** @description The operation to perform on the canvas. */
26 operation?: Operation;
27 /** @description The section of the canvas to target the operation on. */
28 section_id?: string;
29 /** @description Structure describing the type and contents. */
30 document_content?: DocumentContent;
31}
32type ChangeWithSectionAndContent = Required<BaseChange> & {
33 /** @description The operation to perform on the canvas. */
34 operation: 'insert_after' | 'insert_before';
35};
36type ChangeWithContent = Required<Pick<BaseChange, 'document_content'>> & {
37 /** @description The operation to perform on the canvas. */
38 operation: 'insert_at_start' | 'insert_at_end';
39};
40type ChangeWithContentAndOptionalSection = BaseChange & Required<Pick<BaseChange, 'document_content'>> & {
41 /** @description The operation to perform on the canvas. */
42 operation: 'replace';
43};
44type ChangeWithSection = Required<Pick<BaseChange, 'section_id'>> & {
45 /** @description The operation to perform on the canvas. */
46 operation: 'delete';
47};
48type Change = ChangeWithSection | ChangeWithContent | ChangeWithSectionAndContent | ChangeWithContentAndOptionalSection;
49export interface CanvasesAccessDeleteArguments extends CanvasID, Partial<ChannelIDs>, TokenOverridable, Partial<UserIDs> {
50}
51export interface CanvasesAccessSetArguments extends CanvasID, Partial<ChannelIDs>, TokenOverridable, Partial<UserIDs> {
52 /** @description Desired level of access. */
53 access_level: 'read' | 'write';
54}
55export type CanvasesCreateArguments = OptionalArgument<TokenOverridable & {
56 /** @description Title of the newly created canvas. */
57 title?: string;
58 /** @description Structure describing the type and contents of the Canvas being created. */
59 document_content?: DocumentContent;
60}>;
61export interface CanvasesSectionsLookupArguments extends CanvasID, TokenOverridable {
62 /** @description Filtering criteria. */
63 criteria: Criteria;
64}
65export interface CanvasesDeleteArguments extends CanvasID, TokenOverridable {
66}
67export interface CanvasesEditArguments extends CanvasID, TokenOverridable {
68 /** @description List of changes to apply to the canvas. */
69 changes: [Change, ...Change[]];
70}
71export interface ConversationsCanvasesCreateArguments extends ChannelID, TokenOverridable {
72 /** @description Structure describing the type and contents of the Canvas being created. */
73 document_content?: DocumentContent;
74}
75export {};
76//# sourceMappingURL=canvas.d.ts.map
\No newline at end of file