1 | import type { OptionalArgument } from '../helpers';
|
2 | import type { ChannelID, ChannelIDs, TokenOverridable, UserIDs } from './common';
|
3 | interface CanvasID {
|
4 |
|
5 | canvas_id: string;
|
6 | }
|
7 | export interface DocumentContent {
|
8 |
|
9 | type: 'markdown';
|
10 |
|
11 | markdown: string;
|
12 | }
|
13 | type SectionType = 'any_header' | 'h1' | 'h2' | 'h3';
|
14 | interface SectionTypes {
|
15 |
|
16 | section_types: [SectionType, ...SectionType[]];
|
17 | }
|
18 | interface ContainsText {
|
19 |
|
20 | contains_text: string;
|
21 | }
|
22 | type Criteria = (SectionTypes & Partial<ContainsText>) | (Partial<SectionTypes> & ContainsText);
|
23 | type Operation = 'insert_after' | 'insert_before' | 'insert_at_start' | 'insert_at_end' | 'replace' | 'delete';
|
24 | interface BaseChange {
|
25 |
|
26 | operation?: Operation;
|
27 |
|
28 | section_id?: string;
|
29 |
|
30 | document_content?: DocumentContent;
|
31 | }
|
32 | type ChangeWithSectionAndContent = Required<BaseChange> & {
|
33 |
|
34 | operation: 'insert_after' | 'insert_before';
|
35 | };
|
36 | type ChangeWithContent = Required<Pick<BaseChange, 'document_content'>> & {
|
37 |
|
38 | operation: 'insert_at_start' | 'insert_at_end';
|
39 | };
|
40 | type ChangeWithContentAndOptionalSection = BaseChange & Required<Pick<BaseChange, 'document_content'>> & {
|
41 |
|
42 | operation: 'replace';
|
43 | };
|
44 | type ChangeWithSection = Required<Pick<BaseChange, 'section_id'>> & {
|
45 |
|
46 | operation: 'delete';
|
47 | };
|
48 | type Change = ChangeWithSection | ChangeWithContent | ChangeWithSectionAndContent | ChangeWithContentAndOptionalSection;
|
49 | export interface CanvasesAccessDeleteArguments extends CanvasID, Partial<ChannelIDs>, TokenOverridable, Partial<UserIDs> {
|
50 | }
|
51 | export interface CanvasesAccessSetArguments extends CanvasID, Partial<ChannelIDs>, TokenOverridable, Partial<UserIDs> {
|
52 |
|
53 | access_level: 'read' | 'write';
|
54 | }
|
55 | export type CanvasesCreateArguments = OptionalArgument<TokenOverridable & {
|
56 |
|
57 | title?: string;
|
58 |
|
59 | document_content?: DocumentContent;
|
60 | }>;
|
61 | export interface CanvasesSectionsLookupArguments extends CanvasID, TokenOverridable {
|
62 |
|
63 | criteria: Criteria;
|
64 | }
|
65 | export interface CanvasesDeleteArguments extends CanvasID, TokenOverridable {
|
66 | }
|
67 | export interface CanvasesEditArguments extends CanvasID, TokenOverridable {
|
68 |
|
69 | changes: [Change, ...Change[]];
|
70 | }
|
71 | export interface ConversationsCanvasesCreateArguments extends ChannelID, TokenOverridable {
|
72 |
|
73 | document_content?: DocumentContent;
|
74 | }
|
75 | export {};
|
76 |
|
\ | No newline at end of file |