-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new built-in steps: add canvas to channel tab, expose new title o…
…utput parameter on create canvas and channel create canvas steps, canvas update content step now calls backwards-compatible canvas_update_content_v2 step under the hood. add support for "id aliases" in function generation
- Loading branch information
Filip Maj
committed
Oct 8, 2024
1 parent
834464d
commit eff1b17
Showing
11 changed files
with
202 additions
and
10 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/** 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_canvas_to_channel_tab", | ||
source_file: "", | ||
title: "Add a canvas to channel tab", | ||
input_parameters: { | ||
properties: { | ||
label: { | ||
type: SchemaTypes.string, | ||
description: "Enter a tab label", | ||
title: "Tab label", | ||
}, | ||
channel_id: { | ||
type: SlackTypes.channel_id, | ||
description: "Channel name", | ||
title: "Select a channel", | ||
}, | ||
canvas_id: { | ||
type: SlackTypes.canvas_id, | ||
description: "Search all canvases", | ||
title: "Select a canvas to add as a tab", | ||
}, | ||
}, | ||
required: ["channel_id", "canvas_id"], | ||
}, | ||
output_parameters: { | ||
properties: { | ||
canvas_id: { | ||
type: SlackTypes.canvas_id, | ||
description: "Canvas link", | ||
title: "Canvas link", | ||
}, | ||
channel_id: { | ||
type: SlackTypes.channel_id, | ||
description: "Channel name", | ||
title: "Channel name", | ||
}, | ||
}, | ||
required: ["canvas_id", "channel_id"], | ||
}, | ||
}); |
93 changes: 93 additions & 0 deletions
93
src/schema/slack/functions/add_canvas_to_channel_tab_test.ts
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,93 @@ | ||
/** 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 AddCanvasToChannelTab from "./add_canvas_to_channel_tab.ts"; | ||
|
||
Deno.test("AddCanvasToChannelTab generates valid FunctionManifest", () => { | ||
assertEquals( | ||
AddCanvasToChannelTab.definition.callback_id, | ||
"slack#/functions/add_canvas_to_channel_tab", | ||
); | ||
const expected: ManifestFunctionSchema = { | ||
source_file: "", | ||
title: "Add a canvas to channel tab", | ||
input_parameters: { | ||
properties: { | ||
label: { | ||
type: SchemaTypes.string, | ||
description: "Enter a tab label", | ||
title: "Tab label", | ||
}, | ||
channel_id: { | ||
type: SlackTypes.channel_id, | ||
description: "Channel name", | ||
title: "Select a channel", | ||
}, | ||
canvas_id: { | ||
type: SlackTypes.canvas_id, | ||
description: "Search all canvases", | ||
title: "Select a canvas to add as a tab", | ||
}, | ||
}, | ||
required: ["channel_id", "canvas_id"], | ||
}, | ||
output_parameters: { | ||
properties: { | ||
canvas_id: { | ||
type: SlackTypes.canvas_id, | ||
description: "Canvas link", | ||
title: "Canvas link", | ||
}, | ||
channel_id: { | ||
type: SlackTypes.channel_id, | ||
description: "Channel name", | ||
title: "Channel name", | ||
}, | ||
}, | ||
required: ["canvas_id", "channel_id"], | ||
}, | ||
}; | ||
const actual = AddCanvasToChannelTab.export(); | ||
|
||
assertNotStrictEquals(actual, expected); | ||
}); | ||
|
||
Deno.test("AddCanvasToChannelTab can be used as a Slack function in a workflow step", () => { | ||
const testWorkflow = DefineWorkflow({ | ||
callback_id: "test_AddCanvasToChannelTab_slack_function", | ||
title: "Test AddCanvasToChannelTab", | ||
description: "This is a generated test to test AddCanvasToChannelTab", | ||
}); | ||
testWorkflow.addStep(AddCanvasToChannelTab, { | ||
channel_id: "test", | ||
canvas_id: "test", | ||
}); | ||
const actual = testWorkflow.steps[0].export(); | ||
|
||
assertEquals( | ||
actual.function_id, | ||
"slack#/functions/add_canvas_to_channel_tab", | ||
); | ||
assertEquals(actual.inputs, { channel_id: "test", canvas_id: "test" }); | ||
}); | ||
|
||
Deno.test("All outputs of Slack function AddCanvasToChannelTab should exist", () => { | ||
const testWorkflow = DefineWorkflow({ | ||
callback_id: "test_AddCanvasToChannelTab_slack_function", | ||
title: "Test AddCanvasToChannelTab", | ||
description: "This is a generated test to test AddCanvasToChannelTab", | ||
}); | ||
const step = testWorkflow.addStep(AddCanvasToChannelTab, { | ||
channel_id: "test", | ||
canvas_id: "test", | ||
}); | ||
assertExists(step.outputs.canvas_id); | ||
assertExists(step.outputs.channel_id); | ||
}); |
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
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