Skip to content

Commit

Permalink
Add new PagerDuty "Create a status update" connector, Salesforce Read…
Browse files Browse the repository at this point in the history
… Record connector now returns shapeless object (#61)

Co-authored-by: github-actions <[email protected]>
  • Loading branch information
github-actions[bot] and WilliamBergamin authored Nov 4, 2024
1 parent 7b20fd5 commit 958fbc8
Show file tree
Hide file tree
Showing 5 changed files with 119 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/connectors/mod.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/** This file was autogenerated on Mon Oct 21 2024. Follow the steps in src/schema/slack/functions/README.md to rebuild **/
/** This file was autogenerated on Mon Oct 28 2024. Follow the steps in src/schema/slack/functions/README.md to rebuild **/
import AdobeSign from "./adobe.sign/mod.ts";
import Airtable from "./airtable/mod.ts";
import Asana from "./asana/mod.ts";
Expand Down
68 changes: 68 additions & 0 deletions src/connectors/pagerduty/functions/send_status_update.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/** This file was autogenerated. Follow the steps in src/schema/slack/functions/README.md to rebuild **/
import { DefineConnector } from "../../../deps.ts";
import { Schema } from "../../../deps.ts";

export default DefineConnector({
callback_id: "A04RSGH23L7#/functions/send_status_update",
title: "Create a status update",
description: "You'll choose an incident to get the update",
input_parameters: {
properties: {
incident_id: {
type: Schema.types.string,
description: "Enter incident name",
title: "Incident",
},
message: {
type: Schema.types.string,
description: "Enter text",
title: "Status update",
},
subject: {
type: Schema.types.string,
description: "Enter text",
title: "Status update email subject",
},
html_message: {
type: Schema.types.string,
description: "Enter text",
title: "Status update email",
},
pagerduty_access_token: {
type: Schema.slack.types.oauth2,
description: "Pagerduty access token",
title: "PagerDuty access token",
},
},
required: ["incident_id", "message", "pagerduty_access_token"],
},
output_parameters: {
properties: {
id: {
type: Schema.types.string,
description: "Status update ID",
title: "Status update ID",
},
sender: {
type: Schema.types.object,
title: "Created by",
properties: {
id: { type: Schema.types.string, title: "ID" },
type: { type: Schema.types.string, title: "Type" },
summary: { type: Schema.types.string, title: "Name" },
html_url: { type: Schema.types.string, title: "URL" },
},
additionalProperties: true,
required: [],
},
message: { type: Schema.types.string, title: "Status update" },
subject: {
type: Schema.types.string,
title: "Status update email subject",
},
html_message: { type: Schema.types.string, title: "Status update email" },
created_at: { type: Schema.slack.types.timestamp, title: "Created at" },
},
required: ["id", "sender", "message", "created_at"],
},
});
44 changes: 44 additions & 0 deletions src/connectors/pagerduty/functions/send_status_update_test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/** This file was autogenerated. Follow the steps in src/schema/slack/functions/README.md to rebuild **/
import { assertEquals, assertExists } from "../../../dev_deps.ts";
import { DefineWorkflow } from "../../../dev_deps.ts";
import SendStatusUpdate from "./send_status_update.ts";

Deno.test("SendStatusUpdate can be used as a Slack function in a workflow step", () => {
const testWorkflow = DefineWorkflow({
callback_id: "test_SendStatusUpdate_slack_function",
title: "Test SendStatusUpdate",
description: "This is a generated test to test SendStatusUpdate",
});
testWorkflow.addStep(SendStatusUpdate, {
incident_id: "test",
message: "test",
pagerduty_access_token: "test",
});
const actual = testWorkflow.steps[0].export();

assertEquals(actual.function_id, "A04RSGH23L7#/functions/send_status_update");
assertEquals(actual.inputs, {
incident_id: "test",
message: "test",
pagerduty_access_token: "test",
});
});

Deno.test("All outputs of Slack function SendStatusUpdate should exist", () => {
const testWorkflow = DefineWorkflow({
callback_id: "test_SendStatusUpdate_slack_function",
title: "Test SendStatusUpdate",
description: "This is a generated test to test SendStatusUpdate",
});
const step = testWorkflow.addStep(SendStatusUpdate, {
incident_id: "test",
message: "test",
pagerduty_access_token: "test",
});
assertExists(step.outputs.id);
assertExists(step.outputs.sender);
assertExists(step.outputs.message);
assertExists(step.outputs.subject);
assertExists(step.outputs.html_message);
assertExists(step.outputs.created_at);
});
5 changes: 5 additions & 0 deletions src/connectors/pagerduty/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import AddANote from "./functions/add_a_note.ts";
import CreateIncident from "./functions/create_incident.ts";
import EscalateIncident from "./functions/escalate_incident.ts";
import ResolveIncident from "./functions/resolve_incident.ts";
import SendStatusUpdate from "./functions/send_status_update.ts";

const Pagerduty = {
functions: {
Expand All @@ -22,6 +23,10 @@ const Pagerduty = {
* @see The {@link https://api.slack.com/reference/connectors/pagerduty/resolve_incident ResolveIncident} documentation.
*/
ResolveIncident,
/**
* @see The {@link https://api.slack.com/reference/connectors/pagerduty/send_status_update SendStatusUpdate} documentation.
*/
SendStatusUpdate,
},
} as const;

Expand Down
14 changes: 1 addition & 13 deletions src/connectors/salesforce/functions/read_record.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,7 @@ export default DefineConnector({
},
output_parameters: {
properties: {
record: {
type: Schema.types.object,
title: "Record",
properties: {
Id: { type: Schema.types.string },
Name: { type: Schema.types.string },
CreatedById: { type: Schema.types.string },
CreatedDate: { type: Schema.types.string },
Description: { type: Schema.types.string },
},
additionalProperties: true,
required: ["Id"],
},
record: { type: Schema.types.object, title: "Record fields" },
salesforce_object_type: {
type: Schema.types.string,
title: "Salesforce Object Type",
Expand Down

0 comments on commit 958fbc8

Please sign in to comment.