Skip to content

Commit f9644ce

Browse files
authored
Merging pull request #14749
* Added actions * Fixed requested changes * Added requested changes
1 parent baf8c4a commit f9644ce

File tree

6 files changed

+200
-8
lines changed

6 files changed

+200
-8
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
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+
data: {
23+
value: this.value,
24+
lookupId: 67,
25+
},
26+
});
27+
$.export("$summary", `Successfully sent request. Use the ID to get the results: '${response.id}'`);
28+
29+
return response;
30+
},
31+
};
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
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+
data: {
30+
value: this.value,
31+
},
32+
params: {
33+
key: `${this.app.$auth.api_key}`,
34+
},
35+
});
36+
$.export("$summary", `Successfully retrieved the details of the request with ID: '${this.searchId}'`);
37+
return response;
38+
},
39+
};
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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+
data: {
23+
value: this.value,
24+
lookupId: 149,
25+
},
26+
});
27+
$.export("$summary", `Successfully sent request. Use the ID to get the results: '${response.id}'`);
28+
return response;
29+
},
30+
};

components/epsy/epsy.app.mjs

Lines changed: 90 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,96 @@
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 response = await this.getSearchIds();
18+
const searchIds = response.list;
19+
return searchIds.map(({ id }) => ({
20+
value: id,
21+
}));
22+
},
23+
},
24+
},
525
methods: {
6-
// this.$auth contains connected account data
7-
authKeys() {
8-
console.log(Object.keys(this.$auth));
26+
_baseUrl() {
27+
return "https://irbis.espysys.com/api";
28+
},
29+
async _makeRequest(opts = {}) {
30+
const {
31+
$ = this,
32+
path,
33+
headers,
34+
data,
35+
...otherOpts
36+
} = opts;
37+
console.log("Request Options:", {
38+
url: this._baseUrl() + path,
39+
headers: {
40+
...headers,
41+
"accept": "application/json",
42+
"content-type": "application/json",
43+
},
44+
data: {
45+
...data,
46+
key: `${this.$auth.api_key}`,
47+
},
48+
...otherOpts,
49+
});
50+
return axios($, {
51+
...otherOpts,
52+
url: this._baseUrl() + path,
53+
headers: {
54+
...headers,
55+
"accept": "application/json",
56+
"content-type": "application/json",
57+
},
58+
data: {
59+
...data,
60+
key: `${this.$auth.api_key}`,
61+
},
62+
});
63+
},
64+
async emailLookup(args = {}) {
65+
return this._makeRequest({
66+
path: "/developer/combined_email",
67+
method: "post",
68+
...args,
69+
});
70+
},
71+
async nameLookup(args = {}) {
72+
return this._makeRequest({
73+
path: "/developer/combined_name",
74+
method: "post",
75+
...args,
76+
});
77+
},
78+
async getLookupResults({
79+
searchId, ...args
80+
}) {
81+
return this._makeRequest({
82+
path: `/request-monitor/api-usage/${searchId}`,
83+
...args,
84+
});
85+
},
86+
async getSearchIds(args = {}) {
87+
return this._makeRequest({
88+
path: "/request-monitor/api-usage",
89+
params: {
90+
key: `${this.$auth.api_key}`,
91+
},
92+
...args,
93+
});
994
},
1095
},
11-
};
96+
};

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 <support@pipedream.com> (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: 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)