Skip to content

Commit 6d3cf62

Browse files
authored
[Components] chmeetings #13420 (#19371)
* Added actions * Added actions
1 parent 2c8f185 commit 6d3cf62

File tree

6 files changed

+257
-8
lines changed

6 files changed

+257
-8
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import app from "../../chmeetings.app.mjs";
2+
3+
export default {
4+
key: "chmeetings-create-contribution",
5+
name: "Create Contribution",
6+
description: "Create a new contribution in ChMeetings. [See the documentation](https://api.chmeetings.com/scalar/?_gl=1*xb9g3y*_gcl_au*MTI4MjM0MTM4Mi4xNzUzNzIxOTQw#tag/contributions/post/apiv1contributions)",
7+
version: "0.0.1",
8+
annotations: {
9+
destructiveHint: false,
10+
openWorldHint: true,
11+
readOnlyHint: false,
12+
},
13+
type: "action",
14+
props: {
15+
app,
16+
date: {
17+
propDefinition: [
18+
app,
19+
"date",
20+
],
21+
},
22+
paymentMethod: {
23+
propDefinition: [
24+
app,
25+
"paymentMethod",
26+
],
27+
},
28+
fundName: {
29+
propDefinition: [
30+
app,
31+
"fundName",
32+
],
33+
},
34+
amount: {
35+
propDefinition: [
36+
app,
37+
"amount",
38+
],
39+
},
40+
},
41+
async run({ $ }) {
42+
const response = await this.app.createContribution({
43+
$,
44+
data: {
45+
date: this.date,
46+
payment_method: this.paymentMethod,
47+
funds: [
48+
{
49+
fund_name: this.fundName,
50+
amount: this.amount,
51+
},
52+
],
53+
},
54+
});
55+
$.export("$summary", "Successfully created new contribution with ID: " + response.id);
56+
return response;
57+
},
58+
};
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
import app from "../../chmeetings.app.mjs";
2+
3+
export default {
4+
key: "chmeetings-create-person",
5+
name: "Create Person",
6+
description: "Create a new person in ChMeetings. [See the documentation](https://api.chmeetings.com/scalar/?_gl=1*xb9g3y*_gcl_au*MTI4MjM0MTM4Mi4xNzUzNzIxOTQw#tag/people/post/apiv1people)",
7+
version: "0.0.1",
8+
annotations: {
9+
destructiveHint: false,
10+
openWorldHint: true,
11+
readOnlyHint: false,
12+
},
13+
type: "action",
14+
props: {
15+
app,
16+
firstName: {
17+
propDefinition: [
18+
app,
19+
"firstName",
20+
],
21+
},
22+
lastName: {
23+
propDefinition: [
24+
app,
25+
"lastName",
26+
],
27+
},
28+
email: {
29+
propDefinition: [
30+
app,
31+
"email",
32+
],
33+
},
34+
mobile: {
35+
propDefinition: [
36+
app,
37+
"mobile",
38+
],
39+
},
40+
birthDate: {
41+
propDefinition: [
42+
app,
43+
"birthDate",
44+
],
45+
},
46+
church: {
47+
propDefinition: [
48+
app,
49+
"church",
50+
],
51+
},
52+
},
53+
async run({ $ }) {
54+
const response = await this.app.createPerson({
55+
$,
56+
data: {
57+
first_name: this.firstName,
58+
last_name: this.lastName,
59+
email: this.email,
60+
mobile: this.mobile,
61+
birth_date: this.birthDate,
62+
church: this.church,
63+
},
64+
});
65+
$.export("$summary", "Successfully created new person with ID: " + response.id);
66+
return response;
67+
},
68+
};
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import app from "../../chmeetings.app.mjs";
2+
3+
export default {
4+
key: "chmeetings-get-contributions",
5+
name: "Get Contributions",
6+
description: "Get contributions from your ChMeetings account. [See the documentation](https://api.chmeetings.com/scalar/?_gl=1*xb9g3y*_gcl_au*MTI4MjM0MTM4Mi4xNzUzNzIxOTQw#tag/contributions/get/apiv1contributions)",
7+
version: "0.0.1",
8+
annotations: {
9+
destructiveHint: false,
10+
openWorldHint: true,
11+
readOnlyHint: true,
12+
},
13+
type: "action",
14+
props: {
15+
app,
16+
},
17+
async run({ $ }) {
18+
const response = await this.app.getContributions({
19+
$,
20+
});
21+
$.export("$summary", `Successfully retrieved ${response.data.length} contributions`);
22+
return response;
23+
},
24+
};
Lines changed: 97 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,104 @@
1+
import { axios } from "@pipedream/platform";
2+
13
export default {
24
type: "app",
35
app: "chmeetings",
4-
propDefinitions: {},
6+
propDefinitions: {
7+
date: {
8+
type: "string",
9+
label: "Date",
10+
description: "Date of the contribution, i.e.: `2025-11-28T17:32:28Z`",
11+
optional: true,
12+
},
13+
paymentMethod: {
14+
type: "string",
15+
label: "Payment Method",
16+
description: "Method used for the contribution such as cash, credit card or bank transfer",
17+
},
18+
fundName: {
19+
type: "string",
20+
label: "Fund Name",
21+
description: "Name of the fund that will receive the contribution",
22+
},
23+
amount: {
24+
type: "string",
25+
label: "Amount",
26+
description: "Amount of the contribution",
27+
},
28+
firstName: {
29+
type: "string",
30+
label: "First Name",
31+
description: "First name of the person",
32+
},
33+
lastName: {
34+
type: "string",
35+
label: "Last Name",
36+
description: "Last name of the person",
37+
},
38+
email: {
39+
type: "string",
40+
label: "Email",
41+
description: "Email address of the person",
42+
optional: true,
43+
},
44+
mobile: {
45+
type: "string",
46+
label: "Mobile",
47+
description: "Phone number of the person",
48+
optional: true,
49+
},
50+
birthDate: {
51+
type: "string",
52+
label: "Birth Date",
53+
description: "Birth date of the person in YYYY-MM-DD format",
54+
optional: true,
55+
},
56+
church: {
57+
type: "string",
58+
label: "Church",
59+
description: "Church or campus associated with the person",
60+
optional: true,
61+
},
62+
},
563
methods: {
6-
// this.$auth contains connected account data
7-
authKeys() {
8-
console.log(Object.keys(this.$auth));
64+
_baseUrl() {
65+
return "https://api.chmeetings.com/api/v1";
66+
},
67+
async _makeRequest(opts = {}) {
68+
const {
69+
$ = this,
70+
path,
71+
headers,
72+
...otherOpts
73+
} = opts;
74+
return axios($, {
75+
...otherOpts,
76+
url: this._baseUrl() + path,
77+
headers: {
78+
"ApiKey": `${this.$auth.api_key}`,
79+
...headers,
80+
},
81+
});
82+
},
83+
async createContribution(args = {}) {
84+
return this._makeRequest({
85+
path: "/contributions",
86+
method: "post",
87+
...args,
88+
});
89+
},
90+
async getContributions(args = {}) {
91+
return this._makeRequest({
92+
path: "/contributions",
93+
...args,
94+
});
95+
},
96+
async createPerson(args = {}) {
97+
return this._makeRequest({
98+
path: "/people",
99+
method: "post",
100+
...args,
101+
});
9102
},
10103
},
11104
};

components/chmeetings/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/chmeetings",
3-
"version": "0.0.1",
3+
"version": "0.1.0",
44
"description": "Pipedream ChMeetings Components",
55
"main": "chmeetings.app.mjs",
66
"keywords": [
@@ -11,5 +11,8 @@
1111
"author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
1212
"publishConfig": {
1313
"access": "public"
14+
},
15+
"dependencies": {
16+
"@pipedream/platform": "^3.1.1"
1417
}
1518
}

pnpm-lock.yaml

Lines changed: 6 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)