Skip to content

Commit b6a2c8e

Browse files
committed
Added actions
1 parent 7404196 commit b6a2c8e

File tree

3 files changed

+40
-71
lines changed

3 files changed

+40
-71
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+
};

components/momentum_ams/actions/insert-note/insert-note.mjs

Lines changed: 2 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -3,45 +3,15 @@ import app from "../../momentum_ams.app.mjs";
33
export default {
44
key: "momentum_ams-insert-note",
55
name: "Insert Note",
6-
description: "Description for insert-note. [See the documentation](https://docs.google.com/document/d/11Xk7TviRujq806pLK8pQTcdzDF2ClmPvkfnVmdh1bGc/edit?tab=t.0)",
6+
description: "Insert note . [See the documentation](https://docs.google.com/document/d/11Xk7TviRujq806pLK8pQTcdzDF2ClmPvkfnVmdh1bGc/edit?tab=t.0)",
77
version: "0.0.1",
88
type: "action",
99
props: {
1010
app,
11-
count: {
12-
propDefinition: [
13-
app,
14-
"count",
15-
],
16-
},
17-
orderby: {
18-
propDefinition: [
19-
app,
20-
"orderby",
21-
],
22-
},
23-
skip: {
24-
propDefinition: [
25-
app,
26-
"skip",
27-
],
28-
},
29-
top: {
30-
propDefinition: [
31-
app,
32-
"top",
33-
],
34-
},
3511
id: {
3612
propDefinition: [
3713
app,
3814
"id",
39-
(c) => ({
40-
count: c.count,
41-
orderby: c.orderby,
42-
skip: c.skip,
43-
top: c.top,
44-
}),
4515
],
4616
},
4717
subject: {
@@ -79,7 +49,7 @@ export default {
7949
const response = await this.app.insertNote({
8050
$,
8151
data: {
82-
insured_database_id: this.insuredDatabaseId,
52+
insured_database_id: this.id,
8353
subject: this.subject,
8454
creator_name: this.creatorName,
8555
type: this.type,

components/momentum_ams/momentum_ams.app.mjs

Lines changed: 12 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -37,44 +37,22 @@ export default {
3737
type: "string",
3838
label: "Client ID",
3939
description: "The ID of the client",
40-
async options({
41-
count, orderby, skip, top,
42-
}) {
40+
async options({ page }) {
4341
const response = await this.getClients({
44-
count,
45-
orderby,
46-
skip,
47-
top,
42+
params: {
43+
"$top": 10,
44+
"$skip": page * 10,
45+
"$orderby": "id",
46+
},
4847
});
49-
const ids = response.value;
50-
return ids.map(({
48+
return response.value.map(({
5149
id, commercialName,
5250
}) => ({
5351
value: id,
5452
label: commercialName,
5553
}));
5654
},
5755
},
58-
count: {
59-
type: "boolean",
60-
label: "Count",
61-
description: "Returns the total number of records that exist in nowcerts database",
62-
},
63-
orderby: {
64-
type: "string",
65-
label: "Order By",
66-
description: "The parameter used to sort the results, e.g.: `firstName`, `changeDate`)",
67-
},
68-
skip: {
69-
type: "integer",
70-
label: "Skip",
71-
description: "The number of records to skip for pagination purposes",
72-
},
73-
top: {
74-
type: "integer",
75-
label: "Top",
76-
description: "The maximum number of records to retrieve for pagination purposes",
77-
},
7856
},
7957
methods: {
8058
_baseUrl() {
@@ -99,10 +77,12 @@ export default {
9977

10078
async insertNote(args = {}) {
10179
return this._makeRequest({
102-
path: "/InsertNote",
80+
path: "/Zapier/InsertNote",
81+
method: "post",
10382
...args,
10483
});
10584
},
85+
10686
async getClient({
10787
id, ...args
10888
}) {
@@ -111,17 +91,10 @@ export default {
11191
...args,
11292
});
11393
},
114-
async getClients({
115-
count, orderby, skip, top, ...args
116-
}) {
94+
95+
async getClients(args = {}) {
11796
return this._makeRequest({
11897
path: "/InsuredDetailList",
119-
params: {
120-
"$count": count,
121-
"$orderby": orderby,
122-
"$skip": skip,
123-
"$top": top,
124-
},
12598
...args,
12699
});
127100
},

0 commit comments

Comments
 (0)