Skip to content

Commit

Permalink
Update AddUserToUsergroup, RemoveUserFromUsergroup, and `InviteUs…
Browse files Browse the repository at this point in the history
…erToChannel` to support arrays (#142)
  • Loading branch information
smitalpatel22 authored Feb 16, 2023
1 parent 6b78992 commit 8e61e4d
Show file tree
Hide file tree
Showing 29 changed files with 109 additions and 56 deletions.
2 changes: 1 addition & 1 deletion src/schema/slack/functions/add_pin.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/** This file was autogenerated on Wed Feb 15 2023. Follow the steps in src/schema/slack/functions/README.md to rebuild **/
/** This file was autogenerated on Thu Feb 16 2023. Follow the steps in src/schema/slack/functions/README.md to rebuild **/
import { DefineFunction } from "../../../functions/mod.ts";
import SchemaTypes from "../../schema_types.ts";
import SlackTypes from "../schema_types.ts";
Expand Down
2 changes: 1 addition & 1 deletion src/schema/slack/functions/add_pin_test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/** This file was autogenerated on Wed Feb 15 2023. Follow the steps in src/schema/slack/functions/README.md to rebuild **/
/** This file was autogenerated on Thu Feb 16 2023. Follow the steps in src/schema/slack/functions/README.md to rebuild **/
import { assertEquals } from "../../../dev_deps.ts";
import { DefineWorkflow } from "../../../workflows/mod.ts";
import { ManifestFunctionSchema } from "../../../manifest/manifest_schema.ts";
Expand Down
11 changes: 9 additions & 2 deletions src/schema/slack/functions/add_user_to_usergroup.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/** This file was autogenerated on Wed Feb 15 2023. Follow the steps in src/schema/slack/functions/README.md to rebuild **/
/** This file was autogenerated on Thu Feb 16 2023. Follow the steps in src/schema/slack/functions/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({
Expand All @@ -19,8 +20,14 @@ export default DefineFunction({
description: "Search all people",
title: "Select a member",
},
user_ids: {
type: SchemaTypes.array,
description: "Search all people",
title: "Select member(s)",
items: { type: SlackTypes.user_id },
},
},
required: ["usergroup_id", "user_id"],
required: ["usergroup_id"],
},
output_parameters: {
properties: {
Expand Down
19 changes: 11 additions & 8 deletions src/schema/slack/functions/add_user_to_usergroup_test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/** This file was autogenerated on Wed Feb 15 2023. Follow the steps in src/schema/slack/functions/README.md to rebuild **/
/** This file was autogenerated on Thu Feb 16 2023. Follow the steps in src/schema/slack/functions/README.md to rebuild **/
import { assertEquals, assertExists } 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 AddUserToUsergroup from "./add_user_to_usergroup.ts";

Expand All @@ -26,8 +27,14 @@ Deno.test("AddUserToUsergroup generates valid FunctionManifest", () => {
description: "Search all people",
title: "Select a member",
},
user_ids: {
type: SchemaTypes.array,
description: "Search all people",
title: "Select member(s)",
items: { type: SlackTypes.user_id },
},
},
required: ["usergroup_id", "user_id"],
required: ["usergroup_id"],
},
output_parameters: {
properties: {
Expand All @@ -51,14 +58,11 @@ Deno.test("AddUserToUsergroup can be used as a built-in function in a workflow s
title: "Test AddUserToUsergroup",
description: "This is a generated test to test AddUserToUsergroup",
});
testWorkflow.addStep(AddUserToUsergroup, {
usergroup_id: "test",
user_id: "test",
});
testWorkflow.addStep(AddUserToUsergroup, { usergroup_id: "test" });
const actual = testWorkflow.steps[0].export();

assertEquals(actual.function_id, "slack#/functions/add_user_to_usergroup");
assertEquals(actual.inputs, { usergroup_id: "test", user_id: "test" });
assertEquals(actual.inputs, { usergroup_id: "test" });
});

Deno.test("All outputs of built-in function AddUserToUsergroup should exist", () => {
Expand All @@ -69,7 +73,6 @@ Deno.test("All outputs of built-in function AddUserToUsergroup should exist", ()
});
const step = testWorkflow.addStep(AddUserToUsergroup, {
usergroup_id: "test",
user_id: "test",
});
assertExists(step.outputs.usergroup_id);
});
2 changes: 1 addition & 1 deletion src/schema/slack/functions/archive_channel.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/** This file was autogenerated on Wed Feb 15 2023. Follow the steps in src/schema/slack/functions/README.md to rebuild **/
/** This file was autogenerated on Thu Feb 16 2023. Follow the steps in src/schema/slack/functions/README.md to rebuild **/
import { DefineFunction } from "../../../functions/mod.ts";
import SlackTypes from "../schema_types.ts";

Expand Down
2 changes: 1 addition & 1 deletion src/schema/slack/functions/archive_channel_test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/** This file was autogenerated on Wed Feb 15 2023. Follow the steps in src/schema/slack/functions/README.md to rebuild **/
/** This file was autogenerated on Thu Feb 16 2023. Follow the steps in src/schema/slack/functions/README.md to rebuild **/
import { assertEquals, assertExists } from "../../../dev_deps.ts";
import { DefineWorkflow } from "../../../workflows/mod.ts";
import { ManifestFunctionSchema } from "../../../manifest/manifest_schema.ts";
Expand Down
2 changes: 1 addition & 1 deletion src/schema/slack/functions/create_channel.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/** This file was autogenerated on Wed Feb 15 2023. Follow the steps in src/schema/slack/functions/README.md to rebuild **/
/** This file was autogenerated on Thu Feb 16 2023. Follow the steps in src/schema/slack/functions/README.md to rebuild **/
import { DefineFunction } from "../../../functions/mod.ts";
import SchemaTypes from "../../schema_types.ts";
import SlackTypes from "../schema_types.ts";
Expand Down
2 changes: 1 addition & 1 deletion src/schema/slack/functions/create_channel_test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/** This file was autogenerated on Wed Feb 15 2023. Follow the steps in src/schema/slack/functions/README.md to rebuild **/
/** This file was autogenerated on Thu Feb 16 2023. Follow the steps in src/schema/slack/functions/README.md to rebuild **/
import { assertEquals, assertExists } from "../../../dev_deps.ts";
import { DefineWorkflow } from "../../../workflows/mod.ts";
import { ManifestFunctionSchema } from "../../../manifest/manifest_schema.ts";
Expand Down
2 changes: 1 addition & 1 deletion src/schema/slack/functions/create_usergroup.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/** This file was autogenerated on Wed Feb 15 2023. Follow the steps in src/schema/slack/functions/README.md to rebuild **/
/** This file was autogenerated on Thu Feb 16 2023. Follow the steps in src/schema/slack/functions/README.md to rebuild **/
import { DefineFunction } from "../../../functions/mod.ts";
import SchemaTypes from "../../schema_types.ts";
import SlackTypes from "../schema_types.ts";
Expand Down
2 changes: 1 addition & 1 deletion src/schema/slack/functions/create_usergroup_test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/** This file was autogenerated on Wed Feb 15 2023. Follow the steps in src/schema/slack/functions/README.md to rebuild **/
/** This file was autogenerated on Thu Feb 16 2023. Follow the steps in src/schema/slack/functions/README.md to rebuild **/
import { assertEquals, assertExists } from "../../../dev_deps.ts";
import { DefineWorkflow } from "../../../workflows/mod.ts";
import { ManifestFunctionSchema } from "../../../manifest/manifest_schema.ts";
Expand Down
2 changes: 1 addition & 1 deletion src/schema/slack/functions/delay.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/** This file was autogenerated on Wed Feb 15 2023. Follow the steps in src/schema/slack/functions/README.md to rebuild **/
/** This file was autogenerated on Thu Feb 16 2023. Follow the steps in src/schema/slack/functions/README.md to rebuild **/
import { DefineFunction } from "../../../functions/mod.ts";
import SchemaTypes from "../../schema_types.ts";

Expand Down
2 changes: 1 addition & 1 deletion src/schema/slack/functions/delay_test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/** This file was autogenerated on Wed Feb 15 2023. Follow the steps in src/schema/slack/functions/README.md to rebuild **/
/** This file was autogenerated on Thu Feb 16 2023. Follow the steps in src/schema/slack/functions/README.md to rebuild **/
import { assertEquals } from "../../../dev_deps.ts";
import { DefineWorkflow } from "../../../workflows/mod.ts";
import { ManifestFunctionSchema } from "../../../manifest/manifest_schema.ts";
Expand Down
23 changes: 21 additions & 2 deletions src/schema/slack/functions/invite_user_to_channel.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/** This file was autogenerated on Wed Feb 15 2023. Follow the steps in src/schema/slack/functions/README.md to rebuild **/
/** This file was autogenerated on Thu Feb 16 2023. Follow the steps in src/schema/slack/functions/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({
Expand All @@ -20,8 +21,20 @@ export default DefineFunction({
description: "Search all people",
title: "Select a member",
},
channel_ids: {
type: SchemaTypes.array,
description: "Search all channels",
title: "Select channel(s)",
items: { type: SlackTypes.channel_id },
},
user_ids: {
type: SchemaTypes.array,
description: "Search all people",
title: "Select member(s)",
items: { type: SlackTypes.user_id },
},
},
required: ["channel_id", "user_id"],
required: [],
},
output_parameters: {
properties: {
Expand All @@ -30,6 +43,12 @@ export default DefineFunction({
description: "Person who was invited",
title: "Person who was invited",
},
user_ids: {
type: SchemaTypes.array,
description: "Person(s) who were invited",
title: "Person(s) who were invited",
items: { type: SlackTypes.user_id },
},
},
required: [],
},
Expand Down
36 changes: 25 additions & 11 deletions src/schema/slack/functions/invite_user_to_channel_test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/** This file was autogenerated on Wed Feb 15 2023. Follow the steps in src/schema/slack/functions/README.md to rebuild **/
/** This file was autogenerated on Thu Feb 16 2023. Follow the steps in src/schema/slack/functions/README.md to rebuild **/
import { assertEquals, assertExists } 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 InviteUserToChannel from "./invite_user_to_channel.ts";

Expand All @@ -27,8 +28,20 @@ Deno.test("InviteUserToChannel generates valid FunctionManifest", () => {
description: "Search all people",
title: "Select a member",
},
channel_ids: {
type: SchemaTypes.array,
description: "Search all channels",
title: "Select channel(s)",
items: { type: SlackTypes.channel_id },
},
user_ids: {
type: SchemaTypes.array,
description: "Search all people",
title: "Select member(s)",
items: { type: SlackTypes.user_id },
},
},
required: ["channel_id", "user_id"],
required: [],
},
output_parameters: {
properties: {
Expand All @@ -37,6 +50,12 @@ Deno.test("InviteUserToChannel generates valid FunctionManifest", () => {
description: "Person who was invited",
title: "Person who was invited",
},
user_ids: {
type: SchemaTypes.array,
description: "Person(s) who were invited",
title: "Person(s) who were invited",
items: { type: SlackTypes.user_id },
},
},
required: [],
},
Expand All @@ -52,14 +71,11 @@ Deno.test("InviteUserToChannel can be used as a built-in function in a workflow
title: "Test InviteUserToChannel",
description: "This is a generated test to test InviteUserToChannel",
});
testWorkflow.addStep(InviteUserToChannel, {
channel_id: "test",
user_id: "test",
});
testWorkflow.addStep(InviteUserToChannel, {});
const actual = testWorkflow.steps[0].export();

assertEquals(actual.function_id, "slack#/functions/invite_user_to_channel");
assertEquals(actual.inputs, { channel_id: "test", user_id: "test" });
assertEquals(actual.inputs, {});
});

Deno.test("All outputs of built-in function InviteUserToChannel should exist", () => {
Expand All @@ -68,9 +84,7 @@ Deno.test("All outputs of built-in function InviteUserToChannel should exist", (
title: "Test InviteUserToChannel",
description: "This is a generated test to test InviteUserToChannel",
});
const step = testWorkflow.addStep(InviteUserToChannel, {
channel_id: "test",
user_id: "test",
});
const step = testWorkflow.addStep(InviteUserToChannel, {});
assertExists(step.outputs.user_id);
assertExists(step.outputs.user_ids);
});
2 changes: 1 addition & 1 deletion src/schema/slack/functions/mod.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/** This file was autogenerated on Wed Feb 15 2023. Follow the steps in src/schema/slack/functions/README.md to rebuild **/
/** This file was autogenerated on Thu Feb 16 2023. Follow the steps in src/schema/slack/functions/README.md to rebuild **/
import AddPin from "./add_pin.ts";
import AddUserToUsergroup from "./add_user_to_usergroup.ts";
import ArchiveChannel from "./archive_channel.ts";
Expand Down
2 changes: 1 addition & 1 deletion src/schema/slack/functions/open_form.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/** This file was autogenerated on Wed Feb 15 2023. Follow the steps in src/schema/slack/functions/README.md to rebuild **/
/** This file was autogenerated on Thu Feb 16 2023. Follow the steps in src/schema/slack/functions/README.md to rebuild **/
import { DefineFunction } from "../../../functions/mod.ts";
import SchemaTypes from "../../schema_types.ts";
import SlackTypes from "../schema_types.ts";
Expand Down
2 changes: 1 addition & 1 deletion src/schema/slack/functions/open_form_test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/** This file was autogenerated on Wed Feb 15 2023. Follow the steps in src/schema/slack/functions/README.md to rebuild **/
/** This file was autogenerated on Thu Feb 16 2023. Follow the steps in src/schema/slack/functions/README.md to rebuild **/
import { assertEquals, assertExists } from "../../../dev_deps.ts";
import { DefineWorkflow } from "../../../workflows/mod.ts";
import { ManifestFunctionSchema } from "../../../manifest/manifest_schema.ts";
Expand Down
11 changes: 9 additions & 2 deletions src/schema/slack/functions/remove_user_from_usergroup.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/** This file was autogenerated on Wed Feb 15 2023. Follow the steps in src/schema/slack/functions/README.md to rebuild **/
/** This file was autogenerated on Thu Feb 16 2023. Follow the steps in src/schema/slack/functions/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({
Expand All @@ -19,8 +20,14 @@ export default DefineFunction({
description: "Search all people",
title: "Select a member",
},
user_ids: {
type: SchemaTypes.array,
description: "Search all people",
title: "Select member(s)",
items: { type: SlackTypes.user_id },
},
},
required: ["usergroup_id", "user_id"],
required: ["usergroup_id"],
},
output_parameters: {
properties: {
Expand Down
19 changes: 11 additions & 8 deletions src/schema/slack/functions/remove_user_from_usergroup_test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/** This file was autogenerated on Wed Feb 15 2023. Follow the steps in src/schema/slack/functions/README.md to rebuild **/
/** This file was autogenerated on Thu Feb 16 2023. Follow the steps in src/schema/slack/functions/README.md to rebuild **/
import { assertEquals, assertExists } 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 RemoveUserFromUsergroup from "./remove_user_from_usergroup.ts";

Expand All @@ -26,8 +27,14 @@ Deno.test("RemoveUserFromUsergroup generates valid FunctionManifest", () => {
description: "Search all people",
title: "Select a member",
},
user_ids: {
type: SchemaTypes.array,
description: "Search all people",
title: "Select member(s)",
items: { type: SlackTypes.user_id },
},
},
required: ["usergroup_id", "user_id"],
required: ["usergroup_id"],
},
output_parameters: {
properties: {
Expand All @@ -51,17 +58,14 @@ Deno.test("RemoveUserFromUsergroup can be used as a built-in function in a workf
title: "Test RemoveUserFromUsergroup",
description: "This is a generated test to test RemoveUserFromUsergroup",
});
testWorkflow.addStep(RemoveUserFromUsergroup, {
usergroup_id: "test",
user_id: "test",
});
testWorkflow.addStep(RemoveUserFromUsergroup, { usergroup_id: "test" });
const actual = testWorkflow.steps[0].export();

assertEquals(
actual.function_id,
"slack#/functions/remove_user_from_usergroup",
);
assertEquals(actual.inputs, { usergroup_id: "test", user_id: "test" });
assertEquals(actual.inputs, { usergroup_id: "test" });
});

Deno.test("All outputs of built-in function RemoveUserFromUsergroup should exist", () => {
Expand All @@ -72,7 +76,6 @@ Deno.test("All outputs of built-in function RemoveUserFromUsergroup should exist
});
const step = testWorkflow.addStep(RemoveUserFromUsergroup, {
usergroup_id: "test",
user_id: "test",
});
assertExists(step.outputs.usergroup_id);
});
2 changes: 1 addition & 1 deletion src/schema/slack/functions/reply_in_thread.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/** This file was autogenerated on Wed Feb 15 2023. Follow the steps in src/schema/slack/functions/README.md to rebuild **/
/** This file was autogenerated on Thu Feb 16 2023. Follow the steps in src/schema/slack/functions/README.md to rebuild **/
import { DefineFunction } from "../../../functions/mod.ts";
import SchemaTypes from "../../schema_types.ts";
import SlackTypes from "../schema_types.ts";
Expand Down
2 changes: 1 addition & 1 deletion src/schema/slack/functions/reply_in_thread_test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/** This file was autogenerated on Wed Feb 15 2023. Follow the steps in src/schema/slack/functions/README.md to rebuild **/
/** This file was autogenerated on Thu Feb 16 2023. Follow the steps in src/schema/slack/functions/README.md to rebuild **/
import { assertEquals, assertExists } from "../../../dev_deps.ts";
import { DefineWorkflow } from "../../../workflows/mod.ts";
import { ManifestFunctionSchema } from "../../../manifest/manifest_schema.ts";
Expand Down
2 changes: 1 addition & 1 deletion src/schema/slack/functions/send_dm.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/** This file was autogenerated on Wed Feb 15 2023. Follow the steps in src/schema/slack/functions/README.md to rebuild **/
/** This file was autogenerated on Thu Feb 16 2023. Follow the steps in src/schema/slack/functions/README.md to rebuild **/
import { DefineFunction } from "../../../functions/mod.ts";
import SchemaTypes from "../../schema_types.ts";
import SlackTypes from "../schema_types.ts";
Expand Down
2 changes: 1 addition & 1 deletion src/schema/slack/functions/send_dm_test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/** This file was autogenerated on Wed Feb 15 2023. Follow the steps in src/schema/slack/functions/README.md to rebuild **/
/** This file was autogenerated on Thu Feb 16 2023. Follow the steps in src/schema/slack/functions/README.md to rebuild **/
import { assertEquals, assertExists } from "../../../dev_deps.ts";
import { DefineWorkflow } from "../../../workflows/mod.ts";
import { ManifestFunctionSchema } from "../../../manifest/manifest_schema.ts";
Expand Down
2 changes: 1 addition & 1 deletion src/schema/slack/functions/send_ephemeral_message.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/** This file was autogenerated on Wed Feb 15 2023. Follow the steps in src/schema/slack/functions/README.md to rebuild **/
/** This file was autogenerated on Thu Feb 16 2023. Follow the steps in src/schema/slack/functions/README.md to rebuild **/
import { DefineFunction } from "../../../functions/mod.ts";
import SchemaTypes from "../../schema_types.ts";
import SlackTypes from "../schema_types.ts";
Expand Down
2 changes: 1 addition & 1 deletion src/schema/slack/functions/send_ephemeral_message_test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/** This file was autogenerated on Wed Feb 15 2023. Follow the steps in src/schema/slack/functions/README.md to rebuild **/
/** This file was autogenerated on Thu Feb 16 2023. Follow the steps in src/schema/slack/functions/README.md to rebuild **/
import { assertEquals, assertExists } from "../../../dev_deps.ts";
import { DefineWorkflow } from "../../../workflows/mod.ts";
import { ManifestFunctionSchema } from "../../../manifest/manifest_schema.ts";
Expand Down
2 changes: 1 addition & 1 deletion src/schema/slack/functions/send_message.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/** This file was autogenerated on Wed Feb 15 2023. Follow the steps in src/schema/slack/functions/README.md to rebuild **/
/** This file was autogenerated on Thu Feb 16 2023. Follow the steps in src/schema/slack/functions/README.md to rebuild **/
import { DefineFunction } from "../../../functions/mod.ts";
import SchemaTypes from "../../schema_types.ts";
import SlackTypes from "../schema_types.ts";
Expand Down
2 changes: 1 addition & 1 deletion src/schema/slack/functions/send_message_test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/** This file was autogenerated on Wed Feb 15 2023. Follow the steps in src/schema/slack/functions/README.md to rebuild **/
/** This file was autogenerated on Thu Feb 16 2023. Follow the steps in src/schema/slack/functions/README.md to rebuild **/
import { assertEquals, assertExists } from "../../../dev_deps.ts";
import { DefineWorkflow } from "../../../workflows/mod.ts";
import { ManifestFunctionSchema } from "../../../manifest/manifest_schema.ts";
Expand Down
Loading

0 comments on commit 8e61e4d

Please sign in to comment.