-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- updated some property titles - create-channel built in now accepts an optional team id (fixes #267) - added new Add Bookmark builtin - openform now accepts an on_submit_function_config input
- Loading branch information
Filip Maj
committed
Jun 6, 2024
1 parent
5a4140f
commit fb5e6a4
Showing
29 changed files
with
237 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/** This file was autogenerated. Follow the steps in src/schema/slack/functions/_scripts/README.md to rebuild **/ | ||
import { DefineFunction } from "../../../functions/mod.ts"; | ||
import SchemaTypes from "../../schema_types.ts"; | ||
import SlackTypes from "../schema_types.ts"; | ||
|
||
export default DefineFunction({ | ||
callback_id: "slack#/functions/add_bookmark", | ||
source_file: "", | ||
title: "Add a bookmark", | ||
input_parameters: { | ||
properties: { | ||
channel_id: { | ||
type: SlackTypes.channel_id, | ||
description: "Search all channels", | ||
title: "Select a channel", | ||
}, | ||
name: { | ||
type: SchemaTypes.string, | ||
description: "Enter the bookmark name", | ||
title: "Bookmark name", | ||
}, | ||
link: { | ||
type: SchemaTypes.string, | ||
description: "https://docs.acme.com", | ||
title: "Bookmark Link", | ||
}, | ||
}, | ||
required: ["channel_id", "name", "link"], | ||
}, | ||
output_parameters: { | ||
properties: { | ||
channel_id: { | ||
type: SlackTypes.channel_id, | ||
description: "Channel", | ||
title: "Channel", | ||
}, | ||
bookmark_name: { | ||
type: SchemaTypes.string, | ||
description: "Bookmark name", | ||
title: "Bookmark name", | ||
}, | ||
bookmark_link: { | ||
type: SchemaTypes.string, | ||
description: "Bookmark link", | ||
title: "Bookmark link", | ||
}, | ||
}, | ||
required: ["channel_id", "bookmark_name", "bookmark_link"], | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
/** This file was autogenerated. Follow the steps in src/schema/slack/functions/_scripts/README.md to rebuild **/ | ||
import { | ||
assertEquals, | ||
assertExists, | ||
assertNotStrictEquals, | ||
} from "../../../dev_deps.ts"; | ||
import { DefineWorkflow } from "../../../workflows/mod.ts"; | ||
import { ManifestFunctionSchema } from "../../../manifest/manifest_schema.ts"; | ||
import SchemaTypes from "../../schema_types.ts"; | ||
import SlackTypes from "../schema_types.ts"; | ||
import AddBookmark from "./add_bookmark.ts"; | ||
|
||
Deno.test("AddBookmark generates valid FunctionManifest", () => { | ||
assertEquals( | ||
AddBookmark.definition.callback_id, | ||
"slack#/functions/add_bookmark", | ||
); | ||
const expected: ManifestFunctionSchema = { | ||
source_file: "", | ||
title: "Add a bookmark", | ||
input_parameters: { | ||
properties: { | ||
channel_id: { | ||
type: SlackTypes.channel_id, | ||
description: "Search all channels", | ||
title: "Select a channel", | ||
}, | ||
name: { | ||
type: SchemaTypes.string, | ||
description: "Enter the bookmark name", | ||
title: "Bookmark name", | ||
}, | ||
link: { | ||
type: SchemaTypes.string, | ||
description: "https://docs.acme.com", | ||
title: "Bookmark Link", | ||
}, | ||
}, | ||
required: ["channel_id", "name", "link"], | ||
}, | ||
output_parameters: { | ||
properties: { | ||
channel_id: { | ||
type: SlackTypes.channel_id, | ||
description: "Channel", | ||
title: "Channel", | ||
}, | ||
bookmark_name: { | ||
type: SchemaTypes.string, | ||
description: "Bookmark name", | ||
title: "Bookmark name", | ||
}, | ||
bookmark_link: { | ||
type: SchemaTypes.string, | ||
description: "Bookmark link", | ||
title: "Bookmark link", | ||
}, | ||
}, | ||
required: ["channel_id", "bookmark_name", "bookmark_link"], | ||
}, | ||
}; | ||
const actual = AddBookmark.export(); | ||
|
||
assertNotStrictEquals(actual, expected); | ||
}); | ||
|
||
Deno.test("AddBookmark can be used as a Slack function in a workflow step", () => { | ||
const testWorkflow = DefineWorkflow({ | ||
callback_id: "test_AddBookmark_slack_function", | ||
title: "Test AddBookmark", | ||
description: "This is a generated test to test AddBookmark", | ||
}); | ||
testWorkflow.addStep(AddBookmark, { | ||
channel_id: "test", | ||
name: "test", | ||
link: "test", | ||
}); | ||
const actual = testWorkflow.steps[0].export(); | ||
|
||
assertEquals(actual.function_id, "slack#/functions/add_bookmark"); | ||
assertEquals(actual.inputs, { | ||
channel_id: "test", | ||
name: "test", | ||
link: "test", | ||
}); | ||
}); | ||
|
||
Deno.test("All outputs of Slack function AddBookmark should exist", () => { | ||
const testWorkflow = DefineWorkflow({ | ||
callback_id: "test_AddBookmark_slack_function", | ||
title: "Test AddBookmark", | ||
description: "This is a generated test to test AddBookmark", | ||
}); | ||
const step = testWorkflow.addStep(AddBookmark, { | ||
channel_id: "test", | ||
name: "test", | ||
link: "test", | ||
}); | ||
assertExists(step.outputs.channel_id); | ||
assertExists(step.outputs.bookmark_name); | ||
assertExists(step.outputs.bookmark_link); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.