Skip to content

Commit e3f1775

Browse files
committed
Merge remote-tracking branch 'origin/master' into hubspot-updates
2 parents a213b9f + 8e80461 commit e3f1775

File tree

18 files changed

+463
-32
lines changed

18 files changed

+463
-32
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
export default {
2+
type: "app",
3+
app: "ayrshare",
4+
propDefinitions: {},
5+
methods: {
6+
// this.$auth contains connected account data
7+
authKeys() {
8+
console.log(Object.keys(this.$auth));
9+
},
10+
},
11+
};

components/ayrshare/package.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "@pipedream/ayrshare",
3+
"version": "0.0.1",
4+
"description": "Pipedream Ayrshare Components",
5+
"main": "ayrshare.app.mjs",
6+
"keywords": [
7+
"pipedream",
8+
"ayrshare"
9+
],
10+
"homepage": "https://pipedream.com/apps/ayrshare",
11+
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
12+
"publishConfig": {
13+
"access": "public"
14+
}
15+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import app from "../../badger_maps.app.mjs";
2+
3+
export default {
4+
key: "badger_maps-delete-account",
5+
name: "Delete Account",
6+
description: "Deletes an account. [See the docs](https://badgerupdatedapi.docs.apiary.io/#reference/accounts/retrieve-and-update-account-details/delete-customer).",
7+
type: "action",
8+
version: "0.0.1",
9+
props: {
10+
app,
11+
accountId: {
12+
propDefinition: [
13+
app,
14+
"accountId",
15+
],
16+
},
17+
},
18+
methods: {
19+
deleteAccount({
20+
accountId, ...args
21+
} = {}) {
22+
return this.app.delete({
23+
path: `/customers/${accountId}/`,
24+
...args,
25+
});
26+
},
27+
},
28+
async run({ $: step }) {
29+
const {
30+
deleteAccount,
31+
accountId,
32+
} = this;
33+
34+
const response = await deleteAccount({
35+
step,
36+
accountId,
37+
});
38+
39+
step.export("$summary", `Successfully deleted account with ID ${accountId}.`);
40+
41+
return response || {
42+
success: true,
43+
};
44+
},
45+
};

components/badger_maps/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/badger_maps",
3-
"version": "0.0.3",
3+
"version": "0.1.0",
44
"description": "Pipedream Badger Maps Components",
55
"main": "badger_maps.app.mjs",
66
"keywords": [

components/certifier/README.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Overview
2+
3+
Certifier is a comprehensive SaaS platform that streamlines and automates the process of issuing and managing digital credentials. With its intuitive API, Certifier allows organizations to effortlessly generate, distribute, and monitor credentials, enhancing efficiency, security, and compliance in a variety of industries.
4+
5+
# Example Use Cases
6+
7+
- **Online Course Completion Certificates**: Automatically generate and distribute certificates to students upon course completion, enhancing the learning experience and recognition.
8+
9+
- **Event Participation Badges**: Issue personalized digital badges to attendees of webinars, conferences, or workshops, making it easy for them to share their achievements on social media.
10+
11+
- **Employee Recognition**: Streamline the process of awarding certificates or badges for employee achievements, such as "Employee of the Month" or training program completions.
Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
import certifier from "../../certifier.app.mjs";
2+
3+
export default {
4+
name: "Issue Credential",
5+
version: "0.0.1",
6+
key: "certifier-issue-credential",
7+
description:
8+
"Create, issue and send a credential to a recipient. [See the documentation](https://developers.certifier.io/reference/create-issue-send-a-credential)",
9+
props: {
10+
certifier,
11+
groupId: {
12+
propDefinition: [
13+
certifier,
14+
"groupId",
15+
],
16+
// reloadProps is used so that customAttributes can be loaded
17+
// However, note that in the Certifier app custom attributes
18+
// are defined on a workspace level, not group
19+
reloadProps: true,
20+
},
21+
recipientName: {
22+
propDefinition: [
23+
certifier,
24+
"recipientName",
25+
],
26+
},
27+
recipientEmail: {
28+
propDefinition: [
29+
certifier,
30+
"recipientEmail",
31+
],
32+
},
33+
issueCredential: {
34+
propDefinition: [
35+
certifier,
36+
"issueCredential",
37+
],
38+
},
39+
sendCredential: {
40+
propDefinition: [
41+
certifier,
42+
"sendCredential",
43+
],
44+
},
45+
issueDate: {
46+
propDefinition: [
47+
certifier,
48+
"issueDate",
49+
],
50+
},
51+
expiryDate: {
52+
propDefinition: [
53+
certifier,
54+
"expiryDate",
55+
],
56+
},
57+
},
58+
async additionalProps() {
59+
const attributes = await this.certifier.searchAttributes();
60+
return attributes
61+
.filter((attribute) => !attribute.isDefault)
62+
.reduce(
63+
(acc, attribute) => ({
64+
...acc,
65+
[attribute.tag]: {
66+
type: "string",
67+
label: `Custom Attribute: ${attribute.name}`,
68+
optional: true,
69+
},
70+
}),
71+
{},
72+
);
73+
},
74+
type: "action",
75+
methods: {},
76+
async run({ $ }) {
77+
const {
78+
certifier,
79+
groupId,
80+
recipientName,
81+
recipientEmail,
82+
issueCredential,
83+
sendCredential,
84+
issueDate,
85+
expiryDate,
86+
} = this;
87+
88+
const customAttributes = Object.fromEntries(
89+
Object.entries(this).filter(([
90+
key,
91+
]) => key.startsWith("custom.")),
92+
);
93+
94+
let response = await certifier.createCredential({
95+
$,
96+
data: {
97+
groupId: groupId,
98+
recipient: {
99+
email: recipientEmail,
100+
name: recipientName,
101+
},
102+
customAttributes,
103+
...(issueDate && {
104+
issueDate,
105+
}),
106+
...(expiryDate && {
107+
expiryDate,
108+
}),
109+
},
110+
});
111+
112+
console.log(`Successfully created credential with ID \`${response.id}\`.`);
113+
114+
if (issueCredential) {
115+
response = await certifier.issueCredential(response.id, {
116+
$,
117+
});
118+
119+
console.log(`Successfully issued credential with ID \`${response.id}\`.`);
120+
121+
if (sendCredential) {
122+
response = await certifier.sendCredential(response.id, {
123+
$,
124+
data: {
125+
deliveryMethod: "email",
126+
},
127+
});
128+
129+
console.log(`Successfully sent credential with ID \`${response.id}\`.`);
130+
}
131+
}
132+
133+
$.export(
134+
"$summary",
135+
`Successfully created credential for ${response.recipient.name}`,
136+
);
137+
138+
return response;
139+
},
140+
};
Lines changed: 119 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,125 @@
1+
import { axios } from "@pipedream/platform";
2+
13
export default {
24
type: "app",
35
app: "certifier",
4-
propDefinitions: {},
56
methods: {
6-
// this.$auth contains connected account data
7-
authKeys() {
8-
console.log(Object.keys(this.$auth));
7+
getUrl(path, apiVersion = "v1") {
8+
return `https://api.certifier.io/${apiVersion}${path}`;
9+
},
10+
getHeaders(headers = {}) {
11+
return {
12+
"Content-Type": "application/json",
13+
"Authorization": `Bearer ${this.$auth.access_token}`,
14+
"Certifier-Version": "2022-10-26",
15+
...headers,
16+
};
17+
},
18+
callApi({
19+
$ = this, path, headers, apiVersion, ...args
20+
} = {}) {
21+
return axios($, {
22+
url: this.getUrl(path, apiVersion),
23+
headers: this.getHeaders(headers),
24+
...args,
25+
});
26+
},
27+
searchGroups(args = {}) {
28+
return this.callApi({
29+
path: "/groups",
30+
...args,
31+
});
32+
},
33+
searchAttributes(args = {}) {
34+
return this.callApi({
35+
path: "/attributes",
36+
...args,
37+
});
38+
},
39+
createCredential(args = {}) {
40+
return this.callApi({
41+
method: "POST",
42+
path: "/credentials",
43+
...args,
44+
});
45+
},
46+
issueCredential(id, args = {}) {
47+
return this.callApi({
48+
method: "POST",
49+
path: `/credentials/${id}/issue`,
50+
...args,
51+
});
52+
},
53+
sendCredential(id, args = {}) {
54+
return this.callApi({
55+
method: "POST",
56+
path: `/credentials/${id}/send`,
57+
...args,
58+
});
59+
},
60+
},
61+
propDefinitions: {
62+
groupId: {
63+
type: "string",
64+
label: "Group ID",
65+
description: "The ID of the group",
66+
async options({ prevContext } = {}) {
67+
const response = await this.searchGroups({
68+
params: {
69+
cursor: prevContext.cursor,
70+
},
71+
});
72+
const groups = response.data;
73+
const cursor = response.pagination.next;
74+
75+
return {
76+
options: groups.map(({
77+
id, name,
78+
}) => ({
79+
label: name,
80+
value: id,
81+
})),
82+
context: {
83+
cursor,
84+
},
85+
};
86+
},
87+
},
88+
recipientName: {
89+
type: "string",
90+
label: "Recipient Name",
91+
description: "The name of the credential’s recipient.",
92+
},
93+
recipientEmail: {
94+
type: "string",
95+
label: "Recipient Email",
96+
description: "The email of the credential’s recipient.",
97+
},
98+
issueCredential: {
99+
type: "boolean",
100+
label: "Issue Credential",
101+
description:
102+
"Whether to issue a credential (`true`) or create a draft (`false`) when the workflow is triggered (default `true`).",
103+
},
104+
sendCredential: {
105+
type: "boolean",
106+
label: "Send Credential",
107+
description:
108+
"Whether to send a credential to a recipient via email (`true`) or not (`false`) when the workflow is triggered (default is `true`). This step is only applicable if \"Issue Credential\" is set to `true`.",
109+
},
110+
issueDate: {
111+
type: "string",
112+
label: "Issue Date",
113+
description:
114+
"The date (in `YYYY-MM-DD` format) of your credential's issuance (by default this field is set to the day when the workflow is triggered).",
115+
optional: true,
116+
},
117+
expiryDate: {
118+
type: "string",
119+
label: "Expiry Date",
120+
description:
121+
"The date (in `YYYY-MM-DD` format) of your credential's expiration. If not provided, expiry date from the group settings will be used (by default this field is empty).",
122+
optional: true,
9123
},
10124
},
11-
};
125+
};

components/certifier/package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/certifier",
3-
"version": "0.0.1",
3+
"version": "0.1.0",
44
"description": "Pipedream Certifier Components",
55
"main": "certifier.app.mjs",
66
"keywords": [
@@ -11,5 +11,8 @@
1111
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
1212
"publishConfig": {
1313
"access": "public"
14+
},
15+
"dependencies": {
16+
"@pipedream/platform": "^3.0.0"
1417
}
15-
}
18+
}

0 commit comments

Comments
 (0)