-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Share Canvas in thread to the deno sdk #311
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,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: [], | ||
}, | ||
}); |
106 changes: 106 additions & 0 deletions
106
src/schema/slack/functions/share_canvas_in_thread_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,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); | ||
}); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This label changed in the built in