Skip to content

Commit 0d9c448

Browse files
authored
Merging pull request #17507
* Added actions * Added actions * Added actions
1 parent dca0d58 commit 0d9c448

File tree

5 files changed

+194
-7
lines changed

5 files changed

+194
-7
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import app from "../../momentum_ams.app.mjs";
2+
3+
export default {
4+
key: "momentum_ams-get-client",
5+
name: "Get Client",
6+
description: "Get data for the client with the specified ID. [See the documentation](https://support.momentumamp.com/nowcerts-rest-api-search-insureds)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
app,
11+
id: {
12+
propDefinition: [
13+
app,
14+
"id",
15+
],
16+
},
17+
},
18+
async run({ $ }) {
19+
const response = await this.app.getClient({
20+
$,
21+
id: this.id,
22+
});
23+
$.export("$summary", "Successfully retrieved the client with ID: " + this.id);
24+
return response;
25+
},
26+
};
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
import app from "../../momentum_ams.app.mjs";
2+
3+
export default {
4+
key: "momentum_ams-insert-note",
5+
name: "Insert Note",
6+
description: "Insert note . [See the documentation](https://docs.google.com/document/d/11Xk7TviRujq806pLK8pQTcdzDF2ClmPvkfnVmdh1bGc/edit?tab=t.0)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
app,
11+
id: {
12+
propDefinition: [
13+
app,
14+
"id",
15+
],
16+
},
17+
subject: {
18+
propDefinition: [
19+
app,
20+
"subject",
21+
],
22+
},
23+
creatorName: {
24+
propDefinition: [
25+
app,
26+
"creatorName",
27+
],
28+
},
29+
type: {
30+
propDefinition: [
31+
app,
32+
"type",
33+
],
34+
},
35+
isStickyNote: {
36+
propDefinition: [
37+
app,
38+
"isStickyNote",
39+
],
40+
},
41+
hide: {
42+
propDefinition: [
43+
app,
44+
"hide",
45+
],
46+
},
47+
},
48+
async run({ $ }) {
49+
const response = await this.app.insertNote({
50+
$,
51+
data: {
52+
insured_database_id: this.id,
53+
subject: this.subject,
54+
creator_name: this.creatorName,
55+
type: this.type,
56+
is_sticky_note: this.isStickyNote,
57+
hide: this.hide,
58+
},
59+
});
60+
$.export("$summary", "Successfully inserted note with subject: " + this.subject);
61+
return response;
62+
},
63+
};
Lines changed: 95 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,102 @@
1+
import { axios } from "@pipedream/platform";
2+
13
export default {
24
type: "app",
35
app: "momentum_ams",
4-
propDefinitions: {},
6+
propDefinitions: {
7+
subject: {
8+
type: "string",
9+
label: "Subject",
10+
description: "The subject or title for the note",
11+
},
12+
creatorName: {
13+
type: "string",
14+
label: "Creator Name",
15+
description: "The name of the user creating the note",
16+
optional: true,
17+
},
18+
type: {
19+
type: "string",
20+
label: "Type",
21+
description: "A category to classify the note",
22+
optional: true,
23+
},
24+
isStickyNote: {
25+
type: "boolean",
26+
label: "Is Sticky Note",
27+
description: "Set to true to make this note a sticky note for higher visibility",
28+
optional: true,
29+
},
30+
hide: {
31+
type: "boolean",
32+
label: "Hide",
33+
description: "Set to true to archive or hide the note from the default view",
34+
optional: true,
35+
},
36+
id: {
37+
type: "string",
38+
label: "Client ID",
39+
description: "The ID of the client",
40+
async options({ page }) {
41+
const response = await this.getClients({
42+
params: {
43+
"$top": 10,
44+
"$skip": page * 10,
45+
"$orderby": "id",
46+
},
47+
});
48+
return response.value.map(({
49+
id, commercialName,
50+
}) => ({
51+
value: id,
52+
label: commercialName,
53+
}));
54+
},
55+
},
56+
},
557
methods: {
6-
// this.$auth contains connected account data
7-
authKeys() {
8-
console.log(Object.keys(this.$auth));
58+
_baseUrl() {
59+
return "https://api.nowcerts.com/api";
60+
},
61+
async _makeRequest(opts = {}) {
62+
const {
63+
$ = this,
64+
path,
65+
headers,
66+
...otherOpts
67+
} = opts;
68+
return axios($, {
69+
...otherOpts,
70+
url: this._baseUrl() + path,
71+
headers: {
72+
Authorization: `Bearer ${this.$auth.oauth_access_token}`,
73+
...headers,
74+
},
75+
});
76+
},
77+
78+
async insertNote(args = {}) {
79+
return this._makeRequest({
80+
path: "/Zapier/InsertNote",
81+
method: "post",
82+
...args,
83+
});
84+
},
85+
86+
async getClient({
87+
id, ...args
88+
}) {
89+
return this._makeRequest({
90+
path: `/InsuredList(${id})`,
91+
...args,
92+
});
93+
},
94+
95+
async getClients(args = {}) {
96+
return this._makeRequest({
97+
path: "/InsuredDetailList",
98+
...args,
99+
});
9100
},
10101
},
11102
};

components/momentum_ams/package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/momentum_ams",
3-
"version": "0.0.1",
3+
"version": "0.1.0",
44
"description": "Pipedream Momentum AMS Components",
55
"main": "momentum_ams.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.1.0"
1417
}
15-
}
18+
}

pnpm-lock.yaml

Lines changed: 5 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)