Skip to content

Commit

Permalink
Add support for functions.* (complete) methods (#1702)
Browse files Browse the repository at this point in the history
  • Loading branch information
misscoded authored and zimeg committed Jan 25, 2024
1 parent b200f39 commit 77581a1
Show file tree
Hide file tree
Showing 31 changed files with 546 additions and 254 deletions.
23 changes: 23 additions & 0 deletions packages/web-api/src/methods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ import {
FilesRevokePublicURLResponse,
FilesSharedPublicURLResponse,
FilesUploadResponse,
FunctionsCompleteErrorResponse,
FunctionsCompleteSuccessResponse,
MigrationExchangeResponse,
OauthAccessResponse,
OauthV2AccessResponse,
Expand Down Expand Up @@ -701,6 +703,14 @@ export abstract class Methods extends EventEmitter<WebClientEvent> {
},
};

public readonly functions = {
completeError: bindApiCall<FunctionsCompleteErrorArguments, FunctionsCompleteErrorResponse>(this, 'functions.completeError'),
completeSuccess: bindApiCall<FunctionsCompleteSuccessArguments, FunctionsCompleteSuccessResponse>(
this,
'functions.completeSuccess',
),
};

public readonly migration = {
exchange: bindApiCall<MigrationExchangeArguments, MigrationExchangeResponse>(this, 'migration.exchange'),
};
Expand Down Expand Up @@ -2020,6 +2030,19 @@ export interface FilesRemoteShareArguments extends WebAPICallOptions, TokenOverr
external_id?: string;
}

/*
* `functions.*`
*/
export interface FunctionsCompleteErrorArguments extends WebAPICallOptions, TokenOverridable {
function_execution_id: string;
error: string;
}

export interface FunctionsCompleteSuccessArguments extends WebAPICallOptions, TokenOverridable {
function_execution_id: string;
outputs: Record<string, unknown>;
}

/*
* `groups.*`
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export interface Function {
date_deleted?: number;
date_updated?: number;
description?: string;
form_enabled?: boolean;
id?: string;
input_parameters?: PutParameter[];
output_parameters?: PutParameter[];
Expand Down
32 changes: 28 additions & 4 deletions packages/web-api/src/response/AppsManifestExportResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,14 @@ export interface Manifest {
_metadata?: Metadata;
display_information?: DisplayInformation;
features?: Features;
functions?: { [key: string]: Function };
oauth_config?: OauthConfig;
settings?: Settings;
}

export interface Metadata {
major_version?: string;
minor_version?: string;
major_version?: number;
minor_version?: number;
}

export interface DisplayInformation {
Expand Down Expand Up @@ -71,9 +72,30 @@ export interface SlashCommand {
usage_hint?: string;
}

export interface Function {
description?: string;
input_parameters?: { [key: string]: PutParameter };
output_parameters?: { [key: string]: PutParameter };
title?: string;
}

export interface PutParameter {
description?: string;
hint?: string;
is_required?: boolean;
maxLength?: number;
maximum?: number;
minLength?: number;
minimum?: number;
name?: string;
title?: string;
type?: string;
}

export interface OauthConfig {
redirect_urls?: string[];
scopes?: Scopes;
redirect_urls?: string[];
scopes?: Scopes;
token_management_enabled?: boolean;
}

export interface Scopes {
Expand All @@ -86,6 +108,8 @@ export interface Settings {
background_color?: string;
description?: string;
event_subscriptions?: EventSubscriptions;
function_runtime?: string;
hermes_app_type?: string;
interactivity?: Interactivity;
long_description?: string;
org_deploy_enabled?: boolean;
Expand Down
7 changes: 4 additions & 3 deletions packages/web-api/src/response/AppsManifestValidateResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@ export type AppsManifestValidateResponse = WebAPICallResult & {
};

export interface Error {
code?: string;
message?: string;
pointer?: string;
code?: string;
message?: string;
pointer?: string;
related_component?: string;
}

export interface ResponseMetadata {
Expand Down
1 change: 1 addition & 0 deletions packages/web-api/src/response/AuthTestResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export type AuthTestResponse = WebAPICallResult & {
bot_id?: string;
enterprise_id?: string;
error?: string;
expires_in?: number;
is_enterprise_install?: boolean;
needed?: string;
ok?: boolean;
Expand Down
4 changes: 4 additions & 0 deletions packages/web-api/src/response/ChatPostMessageResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,7 @@ export interface FileElement {
source_team?: string;
subject?: string;
subtype?: string;
team_pref_version_history_enabled?: boolean;
teams_shared_with?: any[];
template_conversion_ts?: number;
template_description?: string;
Expand Down Expand Up @@ -548,11 +549,13 @@ export interface Shares {
export interface Private {
access?: string;
channel_name?: string;
date_last_shared?: number;
latest_reply?: string;
reply_count?: number;
reply_users?: string[];
reply_users_count?: number;
share_user_id?: string;
source?: string;
team_id?: string;
thread_ts?: string;
ts?: string;
Expand Down Expand Up @@ -768,6 +771,7 @@ export interface MessageFile {
source_team?: string;
subject?: string;
subtype?: string;
team_pref_version_history_enabled?: boolean;
teams_shared_with?: any[];
template_conversion_ts?: number;
template_description?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@ export interface File {
source_team?: string;
subject?: string;
subtype?: string;
team_pref_version_history_enabled?: boolean;
teams_shared_with?: any[];
template_conversion_ts?: number;
template_description?: string;
Expand Down
4 changes: 4 additions & 0 deletions packages/web-api/src/response/ChatUpdateResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,7 @@ export interface BlockFile {
source_team?: string;
subject?: string;
subtype?: string;
team_pref_version_history_enabled?: boolean;
teams_shared_with?: any[];
template_conversion_ts?: number;
template_description?: string;
Expand Down Expand Up @@ -580,6 +581,7 @@ export interface FileElement {
source_team?: string;
subject?: string;
subtype?: string;
team_pref_version_history_enabled?: boolean;
teams_shared_with?: any[];
template_conversion_ts?: number;
template_description?: string;
Expand Down Expand Up @@ -672,11 +674,13 @@ export interface Shares {
export interface Private {
access?: string;
channel_name?: string;
date_last_shared?: number;
latest_reply?: string;
reply_count?: number;
reply_users?: string[];
reply_users_count?: number;
share_user_id?: string;
source?: string;
team_id?: string;
thread_ts?: string;
ts?: string;
Expand Down
4 changes: 4 additions & 0 deletions packages/web-api/src/response/ConversationsHistoryResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,7 @@ export interface FileElement {
source_team?: string;
subject?: string;
subtype?: string;
team_pref_version_history_enabled?: boolean;
teams_shared_with?: any[];
template_conversion_ts?: number;
template_description?: string;
Expand Down Expand Up @@ -564,11 +565,13 @@ export interface Shares {
export interface Private {
access?: string;
channel_name?: string;
date_last_shared?: number;
latest_reply?: string;
reply_count?: number;
reply_users?: string[];
reply_users_count?: number;
share_user_id?: string;
source?: string;
team_id?: string;
thread_ts?: string;
ts?: string;
Expand Down Expand Up @@ -784,6 +787,7 @@ export interface BlockFile {
source_team?: string;
subject?: string;
subtype?: string;
team_pref_version_history_enabled?: boolean;
teams_shared_with?: any[];
template_conversion_ts?: number;
template_description?: string;
Expand Down
1 change: 1 addition & 0 deletions packages/web-api/src/response/ConversationsOpenResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@ export interface File {
source_team?: string;
subject?: string;
subtype?: string;
team_pref_version_history_enabled?: boolean;
teams_shared_with?: any[];
template_conversion_ts?: number;
template_description?: string;
Expand Down
4 changes: 4 additions & 0 deletions packages/web-api/src/response/ConversationsRepliesResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,7 @@ export interface FileElement {
source_team?: string;
subject?: string;
subtype?: string;
team_pref_version_history_enabled?: boolean;
teams_shared_with?: any[];
template_conversion_ts?: number;
template_description?: string;
Expand Down Expand Up @@ -553,11 +554,13 @@ export interface Shares {
export interface Private {
access?: string;
channel_name?: string;
date_last_shared?: number;
latest_reply?: string;
reply_count?: number;
reply_users?: string[];
reply_users_count?: number;
share_user_id?: string;
source?: string;
team_id?: string;
thread_ts?: string;
ts?: string;
Expand Down Expand Up @@ -773,6 +776,7 @@ export interface BlockFile {
source_team?: string;
subject?: string;
subtype?: string;
team_pref_version_history_enabled?: boolean;
teams_shared_with?: any[];
template_conversion_ts?: number;
template_description?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export type FilesCompleteUploadExternalResponse = WebAPICallResult & {
};

export interface File {
alt_txt?: string;
channels?: string[];
comments_count?: number;
created?: number;
Expand All @@ -41,6 +42,8 @@ export interface File {
mimetype?: string;
mode?: string;
name?: string;
original_h?: number;
original_w?: number;
permalink?: string;
permalink_public?: string;
pretty_type?: string;
Expand All @@ -50,6 +53,13 @@ export interface File {
public_url_shared?: boolean;
shares?: Shares;
size?: number;
thumb_160?: string;
thumb_360?: string;
thumb_360_h?: number;
thumb_360_w?: number;
thumb_64?: string;
thumb_80?: string;
thumb_tiny?: string;
timestamp?: number;
title?: string;
url_private?: string;
Expand All @@ -65,10 +75,13 @@ export interface Shares {

export interface Public {
channel_name?: string;
latest_reply?: string;
reply_count?: number;
reply_users?: string[];
reply_users_count?: number;
share_user_id?: string;
source?: string;
team_id?: string;
thread_ts?: string;
ts?: string;
}
3 changes: 3 additions & 0 deletions packages/web-api/src/response/FilesRemoteAddResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ export interface File {
source_team?: string;
subject?: string;
subtype?: string;
team_pref_version_history_enabled?: boolean;
teams_shared_with?: any[];
template_conversion_ts?: number;
template_description?: string;
Expand Down Expand Up @@ -224,11 +225,13 @@ export interface Shares {
export interface Private {
access?: string;
channel_name?: string;
date_last_shared?: number;
latest_reply?: string;
reply_count?: number;
reply_users?: string[];
reply_users_count?: number;
share_user_id?: string;
source?: string;
team_id?: string;
thread_ts?: string;
ts?: string;
Expand Down
3 changes: 3 additions & 0 deletions packages/web-api/src/response/FilesRemoteInfoResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ export interface File {
source_team?: string;
subject?: string;
subtype?: string;
team_pref_version_history_enabled?: boolean;
teams_shared_with?: any[];
template_conversion_ts?: number;
template_description?: string;
Expand Down Expand Up @@ -224,11 +225,13 @@ export interface Shares {
export interface Private {
access?: string;
channel_name?: string;
date_last_shared?: number;
latest_reply?: string;
reply_count?: number;
reply_users?: string[];
reply_users_count?: number;
share_user_id?: string;
source?: string;
team_id?: string;
thread_ts?: string;
ts?: string;
Expand Down
3 changes: 3 additions & 0 deletions packages/web-api/src/response/FilesRemoteShareResponse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@ export interface File {
source_team?: string;
subject?: string;
subtype?: string;
team_pref_version_history_enabled?: boolean;
teams_shared_with?: any[];
template_conversion_ts?: number;
template_description?: string;
Expand Down Expand Up @@ -224,11 +225,13 @@ export interface Shares {
export interface Private {
access?: string;
channel_name?: string;
date_last_shared?: number;
latest_reply?: string;
reply_count?: number;
reply_users?: string[];
reply_users_count?: number;
share_user_id?: string;
source?: string;
team_id?: string;
thread_ts?: string;
ts?: string;
Expand Down
Loading

0 comments on commit 77581a1

Please sign in to comment.