Skip to content

Commit 3473117

Browse files
committed
Workday API
1 parent 4cbbb62 commit 3473117

File tree

68 files changed

+3383
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+3383
-0
lines changed
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
import workday from "../../workday.app.mjs";
2+
import { ConfigurationError } from "@pipedream/platform";
3+
4+
export default {
5+
key: "workday-close-mentorship",
6+
name: "Close Mentorship",
7+
description: "End a mentorship for a given ID. [See the Documentation](https://community.workday.com/sites/default/files/file-hosting/restapi/#talentManagement/v2/post-/mentorships/-ID-/close)",
8+
version: "0.0.1",
9+
annotations: {
10+
destructiveHint: false,
11+
openWorldHint: true,
12+
readOnlyHint: false,
13+
},
14+
15+
type: "action",
16+
props: {
17+
workday,
18+
mentorshipId: {
19+
propDefinition: [
20+
workday,
21+
"mentorshipId",
22+
],
23+
},
24+
comment: {
25+
type: "string",
26+
label: "Comment",
27+
description: "Last event comment (optional). Example: `Lorem ipsum dolor sit amet, ...`",
28+
optional: true,
29+
},
30+
startDate: {
31+
type: "string",
32+
label: "Start Date",
33+
description: "Start date for the mentorship (ISO 8601). Example: `2025-10-18T07:00:00.000Z`",
34+
},
35+
endDate: {
36+
type: "string",
37+
label: "End Date",
38+
description: "End date for the mentorship (ISO 8601). Example: `2025-10-18T07:00:00.000Z`",
39+
},
40+
closeMentorshipReason: {
41+
type: "object",
42+
label: "Close Mentorship Reason",
43+
description: "Example: `{ \"id\": \"00000000000000000000000000000000\" }`",
44+
},
45+
descriptor: {
46+
type: "string",
47+
label: "Descriptor",
48+
description: "Display name. Example: `Lorem ipsum dolor sit ame`",
49+
optional: true,
50+
},
51+
},
52+
async run({ $ }) {
53+
if (
54+
!this.closeMentorshipReason ||
55+
typeof this.closeMentorshipReason !== "object" ||
56+
!this.closeMentorshipReason.id ||
57+
!this.closeMentorshipReason.id.trim()
58+
) {
59+
throw new ConfigurationError("closeMentorshipReason is required and must be an object with a non-empty id property.");
60+
}
61+
62+
const data = {
63+
closeMentorshipReason: this.closeMentorshipReason,
64+
startDate: this.startDate,
65+
endDate: this.endDate,
66+
};
67+
if (this.comment) data.comment = this.comment;
68+
if (this.descriptor) data.descriptor = this.descriptor;
69+
70+
const response = await this.workday.closeMentorship({
71+
id: this.mentorshipId,
72+
data,
73+
$,
74+
});
75+
$.export("$summary", `Mentorship ${this.mentorshipId} closed`);
76+
return response;
77+
},
78+
};
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
import workday from "../../workday.app.mjs";
2+
import { ConfigurationError } from "@pipedream/platform";
3+
import utils from "../../sources/common/utils.mjs";
4+
5+
export default {
6+
key: "workday-create-digital-course",
7+
name: "Create Digital Course",
8+
description: "Create a digital learning course. [See the Documentation](https://community.workday.com/sites/default/files/file-hosting/restapi/#learning/v1/post-/manageDigitalCourses)",
9+
version: "0.0.1",
10+
annotations: {
11+
destructiveHint: false,
12+
openWorldHint: true,
13+
readOnlyHint: false,
14+
},
15+
type: "action",
16+
props: {
17+
workday,
18+
topics: {
19+
type: "string[]",
20+
label: "Topics",
21+
description: "The topics of the learning course event. Example: `[ { \"descriptor\": \"Leadership\", \"id\": \"topic-id-1\" } ]`",
22+
},
23+
title: {
24+
type: "string",
25+
label: "Title",
26+
description: "Course title. Example: `Digital Leadership 101`",
27+
},
28+
availabilityStatus: {
29+
type: "object",
30+
label: "Availability Status",
31+
description: "The status of the learning course event. Example: `{ \"id\": \"status-id-1\" }`",
32+
},
33+
lessons: {
34+
type: "string[]",
35+
label: "Lessons",
36+
description: "The course lessons of the learning course event. Example: `[ { \"title\": \"Lesson 1\", \"type\": { \"id\": \"type-id\" }, \"order\": 1, \"url\": \"https://...\", \"required\": true } ]`",
37+
},
38+
description: {
39+
type: "string",
40+
label: "Description",
41+
description: "Course description. Example: `Learn digital leadership strategies for remote teams.`",
42+
},
43+
},
44+
async run({ $ }) {
45+
const parsedTopics = utils.parseJsonInput(this.topics);
46+
const parsedLessons = utils.parseJsonInput(this.lessons);
47+
48+
if (!Array.isArray(parsedTopics) || parsedTopics.length === 0) {
49+
throw new ConfigurationError("`topics` must be a non-empty array.");
50+
}
51+
for (const t of parsedTopics) {
52+
if (!t.id || !t.descriptor) {
53+
throw new ConfigurationError("Each topic must have both `id` and `descriptor`.");
54+
}
55+
}
56+
57+
if (!Array.isArray(parsedLessons) || parsedLessons.length === 0) {
58+
throw new ConfigurationError("`lessons` must be a non-empty array.");
59+
}
60+
for (const l of parsedLessons) {
61+
if (!l.title || !l.type?.id || typeof l.order !== "number" || !l.url) {
62+
throw new ConfigurationError("Each lesson must include `title`, `type` (object with id), `order` (integer), and `url`.");
63+
}
64+
}
65+
66+
if (!this.title || !this.title.trim()) {
67+
throw new ConfigurationError("`title` is required.");
68+
}
69+
if (!this.availabilityStatus || typeof this.availabilityStatus !== "object" || !this.availabilityStatus.id) {
70+
throw new ConfigurationError("`availabilityStatus` is required and must be an object with a non-empty 'id'.");
71+
}
72+
if (!this.description || !this.description.trim()) {
73+
throw new ConfigurationError("`description` is required.");
74+
}
75+
76+
const data = {
77+
topics: parsedTopics,
78+
title: this.title,
79+
availabilityStatus: this.availabilityStatus,
80+
lessons: parsedLessons,
81+
description: this.description,
82+
};
83+
84+
const response = await this.workday.createDigitalCourse({
85+
$,
86+
data,
87+
});
88+
$.export("$summary", "Digital course created");
89+
return response;
90+
},
91+
};
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
import workday from "../../workday.app.mjs";
2+
import { ConfigurationError } from "@pipedream/platform";
3+
4+
export default {
5+
key: "workday-create-distribution-request",
6+
name: "Create Distribution Request",
7+
description: "Create a new distribution request. [See the Documentation](https://community.workday.com/sites/default/files/file-hosting/restapi/#journeys/v1/post-/distributionRequests)",
8+
version: "0.0.1",
9+
annotations: {
10+
destructiveHint: false,
11+
openWorldHint: true,
12+
readOnlyHint: false,
13+
},
14+
type: "action",
15+
props: {
16+
workday,
17+
builder: {
18+
type: "object",
19+
label: "Builder",
20+
description: "A journey builder object. Example: `{ \"id\": \"00000000000000000000000000000000\" }`",
21+
},
22+
category: {
23+
type: "object",
24+
label: "Category",
25+
description: "A journey category object. Example: `{ \"id\": \"00000000000000000000000000000000\" }`",
26+
},
27+
discoverableBuilder: {
28+
type: "object",
29+
label: "Discoverable Builder",
30+
description: "A discoverable journey builder object. Example: `{ \"id\": \"00000000000000000000000000000000\" }`",
31+
},
32+
includePreviousRecipients: {
33+
type: "boolean",
34+
label: "Include Previous Recipients",
35+
description: "Whether to include previous recipients. Example: `true`",
36+
optional: true,
37+
},
38+
relatedRole: {
39+
type: "object",
40+
label: "Related Role",
41+
description: "Related role object. Example: `{ \"id\": \"00000000000000000000000000000000\" }`",
42+
},
43+
descriptor: {
44+
type: "string",
45+
label: "Descriptor",
46+
description: "Display name for the instance. Example: `Distribution Request for Training`",
47+
optional: true,
48+
},
49+
},
50+
async run({ $ }) {
51+
if (!this.builder || typeof this.builder !== "object" || !this.builder.id || !this.builder.id.trim()) {
52+
throw new ConfigurationError("Builder is required and must be an object with a non-empty id property.");
53+
}
54+
if (!this.category || typeof this.category !== "object" || !this.category.id || !this.category.id.trim()) {
55+
throw new ConfigurationError("Category is required and must be an object with a non-empty id property.");
56+
}
57+
if (this.discoverableBuilder && (typeof this.discoverableBuilder !== "object" || !this.discoverableBuilder.id || !this.discoverableBuilder.id.trim())) {
58+
throw new ConfigurationError("Discoverable Builder (if provided) must be an object with a non-empty id property.");
59+
}
60+
if (this.relatedRole && (typeof this.relatedRole !== "object" || !this.relatedRole.id || !this.relatedRole.id.trim())) {
61+
throw new ConfigurationError("Related Role (if provided) must be an object with a non-empty id property.");
62+
}
63+
64+
const data = {
65+
builder: this.builder,
66+
category: this.category,
67+
};
68+
if (this.discoverableBuilder) data.discoverableBuilder = this.discoverableBuilder;
69+
if (typeof this.includePreviousRecipients === "boolean") data.includePreviousRecipients = this.includePreviousRecipients;
70+
if (this.relatedRole) data.relatedRole = this.relatedRole;
71+
if (this.descriptor) data.descriptor = this.descriptor;
72+
73+
const response = await this.workday.createDistributionRequest({
74+
$,
75+
data,
76+
});
77+
$.export("$summary", "Distribution request created");
78+
return response;
79+
},
80+
};
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import workday from "../../workday.app.mjs";
2+
import { ConfigurationError } from "@pipedream/platform";
3+
4+
export default {
5+
key: "workday-initiate-home-contact-information-change",
6+
name: "Initiate Home Contact Information Change",
7+
description: "Initiates a home contact change for a worker. [See the Documentation](https://community.workday.com/sites/default/files/file-hosting/restapi/#person/v4/)",
8+
version: "0.0.1",
9+
annotations: {
10+
destructiveHint: false,
11+
openWorldHint: true,
12+
readOnlyHint: false,
13+
},
14+
type: "action",
15+
props: {
16+
workday,
17+
workerId: {
18+
propDefinition: [
19+
workday,
20+
"workerId",
21+
],
22+
},
23+
},
24+
async run({ $ }) {
25+
if (!this.workerId || !this.workerId.trim()) {
26+
throw new ConfigurationError("Worker ID is required.");
27+
}
28+
const response = await this.workday.createHomeContactInformationChange({
29+
workerId: this.workerId,
30+
data: {},
31+
$,
32+
});
33+
$.export("$summary", `Home contact change event initiated for worker ID ${this.workerId}`);
34+
return response;
35+
},
36+
};
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
import workday from "../../workday.app.mjs";
2+
import { ConfigurationError } from "@pipedream/platform";
3+
4+
export default {
5+
key: "workday-create-mentorship-for-me",
6+
name: "Create Mentorship For Current User",
7+
description: "Creates a mentorship for the current user. [See the Documentation](https://community.workday.com/sites/default/files/file-hosting/restapi/#talentManagement/v2/post-/createMentorshipForMe)",
8+
version: "0.0.1",
9+
annotations: {
10+
destructiveHint: false,
11+
openWorldHint: true,
12+
readOnlyHint: false,
13+
},
14+
type: "action",
15+
props: {
16+
workday,
17+
endDate: {
18+
type: "string",
19+
label: "End Date",
20+
description: "Proposed end date (ISO 8601 format). Example: '2025-10-18T07:00:00.000Z'",
21+
},
22+
startDate: {
23+
type: "string",
24+
label: "Start Date",
25+
description: "Proposed start date (ISO 8601 format). Example: '2025-10-18T07:00:00.000Z'",
26+
},
27+
purpose: {
28+
type: "string",
29+
label: "Purpose",
30+
description: "Purpose of the mentorship.",
31+
},
32+
mentor: {
33+
type: "object",
34+
label: "Mentor",
35+
description: "Object with at least an `id`. Example: `{ id: \"00000000000000000000000000000000\"}`",
36+
},
37+
comment: {
38+
type: "string",
39+
label: "Comment",
40+
description: "Optional. Comment field for notes or special requests.",
41+
optional: true,
42+
},
43+
mentorType: {
44+
type: "object",
45+
label: "Mentor Type",
46+
description: "Object with at least an `id`. Example: `{ id: \"00000000000000000000000000000000\"}`",
47+
optional: true,
48+
},
49+
descriptor: {
50+
type: "string",
51+
label: "Descriptor",
52+
description: "Optional. Display name of the mentorship.",
53+
optional: true,
54+
},
55+
},
56+
async run({ $ }) {
57+
if (!this.endDate || !this.endDate.trim()) throw new ConfigurationError("End Date is required and cannot be empty.");
58+
if (!this.startDate || !this.startDate.trim()) throw new ConfigurationError("Start Date is required and cannot be empty.");
59+
if (!this.purpose || !this.purpose.trim()) throw new ConfigurationError("Purpose is required and cannot be empty.");
60+
if (!this.mentor || typeof this.mentor !== "object" || !this.mentor.id || !this.mentor.id.trim()) {
61+
throw new ConfigurationError("Mentor is required and must be an object with a non-empty id property.");
62+
}
63+
if (this.mentorType !== undefined) {
64+
if (typeof this.mentorType !== "object" || !this.mentorType.id || !this.mentorType.id.trim()) {
65+
throw new ConfigurationError("If provided, mentorType must be an object with a non-empty id property.");
66+
}
67+
}
68+
69+
const data = {
70+
endDate: this.endDate,
71+
startDate: this.startDate,
72+
purpose: this.purpose,
73+
mentor: this.mentor,
74+
};
75+
if (this.comment) data.comment = this.comment;
76+
if (this.mentorType) data.mentorType = this.mentorType;
77+
if (this.descriptor) data.descriptor = this.descriptor;
78+
79+
const response = await this.workday.createMentorshipForMe({
80+
$,
81+
data,
82+
});
83+
$.export("$summary", "Mentorship created for current user");
84+
return response;
85+
},
86+
};

0 commit comments

Comments
 (0)