mattermost-mobile-upstream/types/api/integrations.d.ts
Scott Bishel c05aea4a2b
Some checks are pending
ci / lint-typecheck (push) Waiting to run
ci / detox-lint-typecheck (push) Waiting to run
ci / test (push) Waiting to run
MM-69122: Add file element support to interactive dialogs (#9898)
* Implement Interactive Dialog - file upload

* update demo plugin version for e2etests

* fix and add e2etests

* review fixes
2026-10-07 14:43:26 -05:00

145 lines
3.3 KiB
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
type Command = {
'id': string;
'token': string;
'create_at': number;
'update_at': number;
'delete_at': number;
'creator_id': string;
'team_id': string;
'trigger': string;
'method': 'P' | 'G' | '';
'username': string;
'icon_url': string;
'auto_complete': boolean;
'auto_complete_desc': string;
'auto_complete_hint': string;
'display_name': string;
'description': string;
'url': string;
'autocomplete_icon_data'?: string;
};
type CommandArgs = {
channel_id: string;
team_id: string;
root_id?: string;
parent_id?: string;
};
// AutocompleteSuggestion represents a single suggestion downloaded from the server.
type AutocompleteSuggestion = {
Complete: string;
Suggestion: string;
Hint: string;
Description: string;
IconData: string;
};
type DialogSubmission = {
url: string;
callback_id: string;
state: string;
user_id: string;
channel_id: string;
team_id: string;
submission: {
[x: string]: string;
};
cancelled: boolean;
file_ids?: string[];
};
type DialogOption = {
text: string;
value: string;
};
type SelectedDialogOption = DialogOption | DialogOption[] | undefined;
type SelectedDialogValue = string | string[] | undefined;
type DialogElement = {
display_name: string;
name: string;
type: InteractiveDialogElementType;
subtype?: InteractiveDialogTextSubtype;
default: string | boolean;
placeholder: string;
help_text: string;
optional: boolean;
min_length: number;
max_length: number;
data_source: string;
data_source_url?: string;
options: DialogOption[];
multiselect?: boolean;
allow_multiple?: boolean;
refresh?: boolean;
// Date/DateTime fields
min_date?: string;
max_date?: string;
time_interval?: number;
datetime_config?: DateTimeConfig;
};
type InteractiveDialogConfig = {
app_id: string;
trigger_id: string;
url: string;
dialog: {
callback_id: string;
title: string;
introduction_text: string;
icon_url?: string;
elements: DialogElement[];
submit_label: string;
notify_on_cancel: boolean;
state: string;
source_url?: string;
};
};
type PostAction = {
id?: string;
type?: string;
name?: string;
disabled?: boolean;
style?: string;
data_source?: string;
options?: PostActionOption[];
default_option?: string;
integration?: PostActionIntegration;
cookie?: string;
};
type PostActionOption = {
text?: string;
value?: string;
};
type PostActionIntegration = {
url?: string;
context?: Record<string, any>;
}
/** `integration_format` on the do-post-action API body — identifies which format originally had the action. */
type PostActionIntegrationFormat =
| 'attachment'
| 'apps_binding'
| 'block'
| 'card'
| 'mm_block';
type PostActionResponse = {
status: string;
trigger_id: string;
goto_location?: string;
};
type InteractiveDialogElementType = 'text' | 'textarea' | 'select' | 'radio' | 'bool' | 'file' | 'date' | 'datetime'
type InteractiveDialogTextSubtype = 'email' | 'number' | 'tel' | 'url' | 'password'