mattermost-mobile/types/actions/apps.d.ts
Daniel Espino García df7945318e
[Apps Framework] Separate calls (#5877)
* Port https://github.com/mattermost/mattermost-webapp/pull/9263 to mobile

* Fix forms props from commands and missing error->text change

* lint

* various fixes

* fix lookups for command parser

* update app command parser

* fixes

* fixes with embedded forms

* lint and types

* remove bindings.expanded fix for cleaning bindings on render

* lint

* re-expand bindings on post update

Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>
2022-03-24 11:03:06 -04:00

38 lines
1.2 KiB
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import {AppCallRequest, AppCallResponse, AppContext} from '@mm-redux/types/apps';
import {Post} from '@mm-redux/types/posts';
export type DoAppCallResult<Res=unknown> = {
data?: AppCallResponse<Res>;
error?: AppCallResponse<Res>;
}
export interface PostEphemeralCallResponseForPost {
(response: AppCallResponse, message: string, post: Post): void;
}
export interface PostEphemeralCallResponseForChannel {
(response: AppCallResponse, message: string, channelID: string): void;
}
export interface PostEphemeralCallResponseForContext {
(response: AppCallResponse, message: string, context: AppContext): void;
}
export interface HandleBindingClick<Res=unknown> {
(binding: AppBinding, context: AppContext, intl: any): Promise<DoAppCallResult<Res>>;
}
export interface DoAppSubmit<Res=unknown> {
(call: AppCallRequest, intl: any): Promise<DoAppCallResult<Res>>;
}
export interface DoAppFetchForm<Res=unknown> {
(call: AppCallRequest, intl: any): Promise<DoAppCallResult<Res>>;
}
export interface DoAppLookup<Res=unknown> {
(call: AppCallRequest, intl: any): Promise<DoAppCallResult<Res>>;
}