Skip to content

Commit a5141c5

Browse files
committed
Merge branch 'master' into issue-13809
2 parents 2163ec6 + fb808e1 commit a5141c5

File tree

747 files changed

+31437
-4098
lines changed

Some content is hidden

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

747 files changed

+31437
-4098
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Run SDK Tests
2+
3+
on:
4+
pull_request:
5+
types: [opened, edited, synchronize]
6+
paths:
7+
- 'packages/sdk/**'
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v3
16+
17+
- name: Set up Node.js
18+
uses: actions/setup-node@v3
19+
with:
20+
node-version: '18'
21+
22+
- name: Install dependencies
23+
run: npm install
24+
working-directory: packages/sdk
25+
26+
- name: Run tests
27+
run: npm test
28+
working-directory: packages/sdk

.github/workflows/pull-request-checks.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
done
3636
3737
echo "files=${files}" >> $GITHUB_ENV
38-
- uses: rojopolis/spellcheck-github-actions@0.40.0
38+
- uses: rojopolis/spellcheck-github-actions@0.42.0
3939
name: Spellcheck
4040
if: ${{ env.files }}
4141
with:
Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
import adhook from "../../adhook.app.mjs";
2+
import { parseObject } from "../../common/utils.mjs";
3+
4+
export default {
5+
key: "adhook-create-calendar-event",
6+
name: "Create Calendar Event",
7+
description: "Generates a personalized calendar event in AdHook. [See the documentation](https://app.adhook.io/api-doc/)",
8+
version: "0.0.1",
9+
type: "action",
10+
props: {
11+
adhook,
12+
title: {
13+
type: "string",
14+
label: "Event Title",
15+
description: "The title of the calendar event",
16+
optional: true,
17+
},
18+
description: {
19+
type: "string",
20+
label: "Event Description",
21+
description: "The description of the calendar event",
22+
optional: true,
23+
},
24+
externalId: {
25+
propDefinition: [
26+
adhook,
27+
"externalId",
28+
],
29+
optional: true,
30+
},
31+
start: {
32+
type: "string",
33+
label: "Start Date",
34+
description: "Start date of the event. **Format: YYYY-MM-DDTHH:MM:SSZ**",
35+
optional: true,
36+
},
37+
end: {
38+
type: "string",
39+
label: "End Date",
40+
description: "End date of the event. **Format: YYYY-MM-DDTHH:MM:SSZ**",
41+
optional: true,
42+
},
43+
allDay: {
44+
type: "boolean",
45+
label: "All Day",
46+
description: "Whether the event lasts all day or not",
47+
optional: true,
48+
},
49+
color: {
50+
type: "string",
51+
label: "Color",
52+
description: "The color of the event",
53+
optional: true,
54+
},
55+
subtenantId: {
56+
propDefinition: [
57+
adhook,
58+
"subtenantId",
59+
],
60+
optional: true,
61+
},
62+
tags: {
63+
propDefinition: [
64+
adhook,
65+
"tags",
66+
],
67+
optional: true,
68+
},
69+
topics: {
70+
propDefinition: [
71+
adhook,
72+
"topics",
73+
],
74+
optional: true,
75+
},
76+
attachments: {
77+
type: "string[]",
78+
label: "Attachments",
79+
description: "A list of objects of attachments for the event. **Format: {\"name\": \"Attachment name\", \"url\":\"https://attachment.com/file.pdf\", \"fileExtension\":\"pdf\"}**",
80+
optional: true,
81+
},
82+
},
83+
async run({ $ }) {
84+
const {
85+
adhook,
86+
tags,
87+
topics,
88+
attachments,
89+
...data
90+
} = this;
91+
92+
const response = await adhook.createCalendarEvent({
93+
$,
94+
data: {
95+
type: "EVENT",
96+
...data,
97+
tags: parseObject(tags),
98+
topics: parseObject(topics)?.map((topic) => ({
99+
name: topic,
100+
})),
101+
attachments: parseObject(attachments),
102+
},
103+
});
104+
105+
$.export("$summary", `Successfully created calendar event: ${response.id}`);
106+
return response;
107+
},
108+
};
Lines changed: 138 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,138 @@
1+
import adhook from "../../adhook.app.mjs";
2+
import constants from "../../common/constants.mjs";
3+
import { parseObject } from "../../common/utils.mjs";
4+
5+
export default {
6+
key: "adhook-create-update-post",
7+
name: "Create or Update Post",
8+
description: "Adds a new post or modifies an existing post in Adhook. [See the documentation](https://app.adhook.io/api-doc/)",
9+
version: "0.0.1",
10+
type: "action",
11+
props: {
12+
adhook,
13+
postId: {
14+
propDefinition: [
15+
adhook,
16+
"postId",
17+
],
18+
optional: true,
19+
},
20+
name: {
21+
type: "string",
22+
label: "Name",
23+
description: "The name of the post",
24+
optional: true,
25+
},
26+
type: {
27+
type: "string",
28+
label: "Type",
29+
description: "The type of the post",
30+
optional: true,
31+
options: constants.TYPE_OPTIONS,
32+
},
33+
subtenantId: {
34+
propDefinition: [
35+
adhook,
36+
"subtenantId",
37+
],
38+
optional: true,
39+
},
40+
status: {
41+
type: "string",
42+
label: "Status",
43+
description: "The status of the post",
44+
optional: true,
45+
options: constants.STATUS_OPTIONS,
46+
},
47+
tags: {
48+
propDefinition: [
49+
adhook,
50+
"tags",
51+
],
52+
optional: true,
53+
},
54+
topics: {
55+
propDefinition: [
56+
adhook,
57+
"topics",
58+
],
59+
optional: true,
60+
},
61+
schedule: {
62+
type: "string",
63+
label: "Schedule",
64+
description: "Whether you want to schedule or publish the post",
65+
optional: true,
66+
options: constants.SCHEDULE_OPTIONS,
67+
},
68+
message: {
69+
type: "string",
70+
label: "Message",
71+
description: "A message to send with the post",
72+
optional: true,
73+
},
74+
promotionType: {
75+
type: "string",
76+
label: "Promotion Type",
77+
description: "The type of the promotion in the post",
78+
optional: true,
79+
options: constants.PROMOTION_TYPE_OPTIONS,
80+
},
81+
campaignName: {
82+
type: "string",
83+
label: "Campaign Name",
84+
description: "The name of the campaign",
85+
optional: true,
86+
},
87+
externalId: {
88+
propDefinition: [
89+
adhook,
90+
"externalId",
91+
],
92+
optional: true,
93+
},
94+
},
95+
async run({ $ }) {
96+
const {
97+
adhook,
98+
postId,
99+
tags,
100+
topics,
101+
...data
102+
} = this;
103+
104+
let postData = {};
105+
106+
if (postId) {
107+
const post = await adhook.getPost({
108+
postId,
109+
});
110+
postData = post;
111+
}
112+
113+
postData = {
114+
...postData,
115+
...data,
116+
tags: parseObject(tags) || postData.tags,
117+
topics: parseObject(topics)?.map((topic) => ({
118+
name: topic,
119+
})) || postData.topics,
120+
};
121+
122+
const fn = postId
123+
? adhook.updatePost
124+
: adhook.createPost;
125+
126+
const response = await fn({
127+
$,
128+
postId,
129+
data: postData,
130+
});
131+
132+
$.export("$summary", `Successfully ${postId
133+
? "updated"
134+
: "created"} post`);
135+
136+
return response;
137+
},
138+
};

0 commit comments

Comments
 (0)