Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
56 changes: 56 additions & 0 deletions components/momentum_ams/actions/get-clients/get-clients.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import app from "../../momentum_ams.app.mjs";

export default {
key: "momentum_ams-get-clients",
name: "Get Clients",
description: "Get a list of the clients. [See the documentation](https://docs.google.com/document/d/11Xk7TviRujq806pLK8pQTcdzDF2ClmPvkfnVmdh1bGc/edit?tab=t.0)",
version: "0.0.1",
type: "action",
props: {
app,
count: {
propDefinition: [
app,
"count",
],
},
orderby: {
propDefinition: [
app,
"orderby",
],
},
skip: {
propDefinition: [
app,
"skip",
],
},
top: {
propDefinition: [
app,
"top",
],
},
id: {
propDefinition: [
app,
"id",
(c) => ({
count: c.count,
orderby: c.orderby,
skip: c.skip,
top: c.top,
}),
],
},
},
async run({ $ }) {
const response = await this.app.getClient({
$,
id: this.id,
});
$.export("$summary", "Successfully retrieved the client with ID: " + this.id);
return response;
},
};
93 changes: 93 additions & 0 deletions components/momentum_ams/actions/insert-note/insert-note.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
import app from "../../momentum_ams.app.mjs";

export default {
key: "momentum_ams-insert-note",
name: "Insert Note",
description: "Description for insert-note. [See the documentation](https://docs.google.com/document/d/11Xk7TviRujq806pLK8pQTcdzDF2ClmPvkfnVmdh1bGc/edit?tab=t.0)",
version: "0.0.1",
type: "action",
props: {
app,
count: {
propDefinition: [
app,
"count",
],
},
orderby: {
propDefinition: [
app,
"orderby",
],
},
skip: {
propDefinition: [
app,
"skip",
],
},
top: {
propDefinition: [
app,
"top",
],
},
id: {
propDefinition: [
app,
"id",
(c) => ({
count: c.count,
orderby: c.orderby,
skip: c.skip,
top: c.top,
}),
],
},
subject: {
propDefinition: [
app,
"subject",
],
},
creatorName: {
propDefinition: [
app,
"creatorName",
],
},
type: {
propDefinition: [
app,
"type",
],
},
isStickyNote: {
propDefinition: [
app,
"isStickyNote",
],
},
hide: {
propDefinition: [
app,
"hide",
],
},
},
async run({ $ }) {
const response = await this.app.insertNote({
$,
data: {
insured_database_id: this.insuredDatabaseId,
subject: this.subject,
creator_name: this.creatorName,
type: this.type,
is_sticky_note: this.isStickyNote,
hide: this.hide,
},
});
$.export("$summary", "Successfully inserted note with subject: " + this.subject);
return response;
},
};
126 changes: 122 additions & 4 deletions components/momentum_ams/momentum_ams.app.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,129 @@
import { axios } from "@pipedream/platform";

export default {
type: "app",
app: "momentum_ams",
propDefinitions: {},
propDefinitions: {
subject: {
type: "string",
label: "Subject",
description: "The subject or title for the note",
},
creatorName: {
type: "string",
label: "Creator Name",
description: "The name of the user creating the note",
optional: true,
},
type: {
type: "string",
label: "Type",
description: "A category to classify the note",
optional: true,
},
isStickyNote: {
type: "boolean",
label: "Is Sticky Note",
description: "Set to true to make this note a sticky note for higher visibility",
optional: true,
},
hide: {
type: "boolean",
label: "Hide",
description: "Set to true to archive or hide the note from the default view",
optional: true,
},
id: {
type: "string",
label: "Client ID",
description: "The ID of the client",
async options({
count, orderby, skip, top,
}) {
const response = await this.getClients({
count,
orderby,
skip,
top,
});
const ids = response.value;
return ids.map(({
id, commercialName,
}) => ({
value: id,
label: commercialName,
}));
},
},
count: {
type: "boolean",
label: "Count",
description: "Returns the total number of records that exist in nowcerts database",
},
orderby: {
type: "string",
label: "Order By",
description: "The parameter used to sort the results, e.g.: `firstName`, `changeDate`)",
},
skip: {
type: "integer",
label: "Skip",
description: "The number of records to skip for pagination purposes",
},
top: {
type: "integer",
label: "Top",
description: "The maximum number of records to retrieve for pagination purposes",
},
},
methods: {
// this.$auth contains connected account data
authKeys() {
console.log(Object.keys(this.$auth));
_baseUrl() {
return "https://api.nowcerts.com/api";
},
async _makeRequest(opts = {}) {
const {
$ = this,
path,
headers,
...otherOpts
} = opts;
return axios($, {
...otherOpts,
url: this._baseUrl() + path,
headers: {
Authorization: `Bearer ${this.$auth.oauth_access_token}`,
...headers,
},
});
},

async insertNote(args = {}) {
return this._makeRequest({
path: "/InsertNote",
...args,
});
},
async getClient({
id, ...args
}) {
return this._makeRequest({
path: `/InsuredList(${id})`,
...args,
});
},
async getClients({
count, orderby, skip, top, ...args
}) {
return this._makeRequest({
path: "/InsuredDetailList",
params: {
"$count": count,
"$orderby": orderby,
"$skip": skip,
"$top": top,
},
...args,
});
},
},
};
7 changes: 5 additions & 2 deletions components/momentum_ams/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/momentum_ams",
"version": "0.0.1",
"version": "0.1.0",
"description": "Pipedream Momentum AMS Components",
"main": "momentum_ams.app.mjs",
"keywords": [
Expand All @@ -11,5 +11,8 @@
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
"publishConfig": {
"access": "public"
},
"dependencies": {
"@pipedream/platform": "^3.1.0"
}
}
}
18 changes: 7 additions & 11 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading