diff --git a/src/schema/slack/functions/canvas_copy.ts b/src/schema/slack/functions/canvas_copy.ts index aeb21496..ba2518f0 100644 --- a/src/schema/slack/functions/canvas_copy.ts +++ b/src/schema/slack/functions/canvas_copy.ts @@ -22,7 +22,7 @@ export default DefineFunction({ }, owner_id: { type: SlackTypes.user_id, - description: "Canvas owner id", + description: "Person", title: "Owner", }, placeholder_values: { diff --git a/src/schema/slack/functions/canvas_create.ts b/src/schema/slack/functions/canvas_create.ts index e6331555..33ded67f 100644 --- a/src/schema/slack/functions/canvas_create.ts +++ b/src/schema/slack/functions/canvas_create.ts @@ -28,7 +28,7 @@ export default DefineFunction({ owner_id: { type: SlackTypes.user_id, description: "Person", - title: "Canvas owner", + title: "Owner", }, content: { type: SlackPrimitiveTypes.expanded_rich_text, diff --git a/src/schema/slack/functions/mod.ts b/src/schema/slack/functions/mod.ts index 575fcee0..f9d4d42f 100644 --- a/src/schema/slack/functions/mod.ts +++ b/src/schema/slack/functions/mod.ts @@ -17,6 +17,7 @@ import SendDm from "./send_dm.ts"; import SendEphemeralMessage from "./send_ephemeral_message.ts"; import SendMessage from "./send_message.ts"; import ShareCanvas from "./share_canvas.ts"; +import ShareCanvasInThread from "./share_canvas_in_thread.ts"; import UpdateChannelTopic from "./update_channel_topic.ts"; const SlackFunctions = { @@ -38,6 +39,7 @@ const SlackFunctions = { SendEphemeralMessage, SendMessage, ShareCanvas, + ShareCanvasInThread, UpdateChannelTopic, } as const; diff --git a/src/schema/slack/functions/share_canvas_in_thread.ts b/src/schema/slack/functions/share_canvas_in_thread.ts new file mode 100644 index 00000000..5337a516 --- /dev/null +++ b/src/schema/slack/functions/share_canvas_in_thread.ts @@ -0,0 +1,55 @@ +/** 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/share_canvas_in_thread", + source_file: "", + title: "Share canvas in thread", + input_parameters: { + properties: { + canvas_id: { + type: SlackTypes.canvas_id, + description: "Search all canvases", + title: "Select a canvas", + }, + message_context: { + type: SlackTypes.message_context, + description: "Select a message to reply to", + title: "Select a message to reply to", + }, + access_level: { + type: SchemaTypes.string, + description: "Select an option", + title: "Select access level", + }, + message: { + type: SlackTypes.rich_text, + description: "Add a message", + title: "Add a message", + }, + reply_broadcast: { + type: SchemaTypes.boolean, + description: "Also send to conversation", + title: "Also send to conversation", + }, + }, + required: ["canvas_id", "message_context", "access_level"], + }, + output_parameters: { + properties: { + canvas_id: { + type: SlackTypes.canvas_id, + description: "Canvas link", + title: "Canvas link", + }, + message_context: { + type: SlackTypes.message_context, + description: "Reference to the message sent", + title: "Reference to the message sent", + }, + }, + required: [], + }, +}); diff --git a/src/schema/slack/functions/share_canvas_in_thread_test.ts b/src/schema/slack/functions/share_canvas_in_thread_test.ts new file mode 100644 index 00000000..c733ab9b --- /dev/null +++ b/src/schema/slack/functions/share_canvas_in_thread_test.ts @@ -0,0 +1,106 @@ +/** 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 ShareCanvasInThread from "./share_canvas_in_thread.ts"; + +Deno.test("ShareCanvasInThread generates valid FunctionManifest", () => { + assertEquals( + ShareCanvasInThread.definition.callback_id, + "slack#/functions/share_canvas_in_thread", + ); + const expected: ManifestFunctionSchema = { + source_file: "", + title: "Share canvas in thread", + input_parameters: { + properties: { + canvas_id: { + type: SlackTypes.canvas_id, + description: "Search all canvases", + title: "Select a canvas", + }, + message_context: { + type: SlackTypes.message_context, + description: "Select a message to reply to", + title: "Select a message to reply to", + }, + access_level: { + type: SchemaTypes.string, + description: "Select an option", + title: "Select access level", + }, + message: { + type: SlackTypes.rich_text, + description: "Add a message", + title: "Add a message", + }, + reply_broadcast: { + type: SchemaTypes.boolean, + description: "Also send to conversation", + title: "Also send to conversation", + }, + }, + required: ["canvas_id", "message_context", "access_level"], + }, + output_parameters: { + properties: { + canvas_id: { + type: SlackTypes.canvas_id, + description: "Canvas link", + title: "Canvas link", + }, + message_context: { + type: SlackTypes.message_context, + description: "Reference to the message sent", + title: "Reference to the message sent", + }, + }, + required: [], + }, + }; + const actual = ShareCanvasInThread.export(); + + assertNotStrictEquals(actual, expected); +}); + +Deno.test("ShareCanvasInThread can be used as a Slack function in a workflow step", () => { + const testWorkflow = DefineWorkflow({ + callback_id: "test_ShareCanvasInThread_slack_function", + title: "Test ShareCanvasInThread", + description: "This is a generated test to test ShareCanvasInThread", + }); + testWorkflow.addStep(ShareCanvasInThread, { + canvas_id: "test", + message_context: "test", + access_level: "test", + }); + const actual = testWorkflow.steps[0].export(); + + assertEquals(actual.function_id, "slack#/functions/share_canvas_in_thread"); + assertEquals(actual.inputs, { + canvas_id: "test", + message_context: "test", + access_level: "test", + }); +}); + +Deno.test("All outputs of Slack function ShareCanvasInThread should exist", () => { + const testWorkflow = DefineWorkflow({ + callback_id: "test_ShareCanvasInThread_slack_function", + title: "Test ShareCanvasInThread", + description: "This is a generated test to test ShareCanvasInThread", + }); + const step = testWorkflow.addStep(ShareCanvasInThread, { + canvas_id: "test", + message_context: "test", + access_level: "test", + }); + assertExists(step.outputs.canvas_id); + assertExists(step.outputs.message_context); +});