Skip to content

Commit 83bc645

Browse files
committed
Added actions
1 parent e86f52d commit 83bc645

File tree

6 files changed

+189
-10
lines changed

6 files changed

+189
-10
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import app from "../../epsy.app.mjs";
2+
3+
export default {
4+
key: "epsy-email-lookup",
5+
name: "Email Lookup",
6+
description: "Request a lookup for the provided email. [See the documentation](https://irbis.espysys.com/developer/)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
app,
11+
value: {
12+
propDefinition: [
13+
app,
14+
"value",
15+
],
16+
},
17+
},
18+
19+
async run({ $ }) {
20+
const response = await this.app.emailLookup({
21+
$,
22+
params: {
23+
value: this.value,
24+
lookupId: "67",
25+
},
26+
});
27+
28+
$.export("$summary", `Successfully sent request. Use the ID to get the results: '${response.id}'`);
29+
30+
return response;
31+
},
32+
};
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import app from "../../epsy.app.mjs";
2+
3+
export default {
4+
key: "epsy-get-lookup-results",
5+
name: "Get Lookup Results",
6+
description: "Get the results of the lookup with the provided ID. [See the documentation](https://irbis.espysys.com/developer/)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
app,
11+
value: {
12+
propDefinition: [
13+
app,
14+
"value",
15+
],
16+
},
17+
searchId: {
18+
propDefinition: [
19+
app,
20+
"searchId",
21+
],
22+
},
23+
},
24+
25+
async run({ $ }) {
26+
const response = await this.app.getLookupResults({
27+
$,
28+
searchId: this.searchId,
29+
params: {
30+
value: this.value,
31+
},
32+
});
33+
34+
$.export("$summary", `Successfully retrieved the details of the request with ID: '${this.searchId}'`);
35+
36+
return response;
37+
},
38+
};
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import app from "../../epsy.app.mjs";
2+
3+
export default {
4+
key: "epsy-name-lookup",
5+
name: "Name Lookup",
6+
description: "Request a lookup for the provided name. [See the documentation](https://irbis.espysys.com/developer/)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
app,
11+
value: {
12+
propDefinition: [
13+
app,
14+
"value",
15+
],
16+
},
17+
},
18+
19+
async run({ $ }) {
20+
const response = await this.app.nameLookup({
21+
$,
22+
params: {
23+
value: this.value,
24+
lookupId: "149",
25+
},
26+
});
27+
28+
$.export("$summary", `Successfully sent request. Use the ID to get the results: '${response.id}'`);
29+
30+
return response;
31+
},
32+
};

components/epsy/epsy.app.mjs

Lines changed: 76 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,82 @@
1+
import { axios } from "@pipedream/platform";
2+
13
export default {
24
type: "app",
35
app: "epsy",
4-
propDefinitions: {},
6+
propDefinitions: {
7+
value: {
8+
type: "string",
9+
label: "Value",
10+
description: "Value to lookup",
11+
},
12+
searchId: {
13+
type: "string",
14+
label: "Search ID",
15+
description: "ID of the search",
16+
async options() {
17+
const searchIds = await this.getSearchIds();
18+
return searchIds.map(({
19+
id, type,
20+
}) => ({
21+
label: type,
22+
value: id,
23+
}));
24+
},
25+
},
26+
},
527
methods: {
6-
// this.$auth contains connected account data
7-
authKeys() {
8-
console.log(Object.keys(this.$auth));
28+
_baseUrl() {
29+
return "https://irbis.espysys.com/api";
30+
},
31+
async _makeRequest(opts = {}) {
32+
const {
33+
$ = this,
34+
path,
35+
headers,
36+
params,
37+
...otherOpts
38+
} = opts;
39+
return axios($, {
40+
...otherOpts,
41+
url: this._baseUrl() + path,
42+
headers: {
43+
...headers,
44+
"accept": "application/json",
45+
"content-type": "application/json",
46+
},
47+
params: {
48+
...params,
49+
key: `${this.$auth.api_key}`,
50+
},
51+
});
52+
},
53+
async emailLookup(args = {}) {
54+
return this._makeRequest({
55+
path: "/developer/combined_email",
56+
method: "post",
57+
...args,
58+
});
59+
},
60+
async nameLookup(args = {}) {
61+
return this._makeRequest({
62+
path: "/developer/combined_name",
63+
method: "post",
64+
...args,
65+
});
66+
},
67+
async getLookupResults({
68+
searchId, ...args
69+
}) {
70+
return this._makeRequest({
71+
path: `/request-monitor/api-usage/${searchId}`,
72+
...args,
73+
});
74+
},
75+
async getSearchIds(args = {}) {
76+
return this._makeRequest({
77+
path: "/request-monitor/api-usage",
78+
...args,
79+
});
980
},
1081
},
11-
};
82+
};

components/epsy/package.json

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

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)