Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
31 changes: 31 additions & 0 deletions components/epsy/actions/email-lookup/email-lookup.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import app from "../../epsy.app.mjs";

export default {
key: "epsy-email-lookup",
name: "Email Lookup",
description: "Request a lookup for the provided email. [See the documentation](https://irbis.espysys.com/developer/)",
version: "0.0.1",
type: "action",
props: {
app,
value: {
propDefinition: [
app,
"value",
],
},
},

async run({ $ }) {
const response = await this.app.emailLookup({
$,
data: {
value: this.value,
lookupId: 67,
},
});
$.export("$summary", `Successfully sent request. Use the ID to get the results: '${response.id}'`);

return response;
},
};
39 changes: 39 additions & 0 deletions components/epsy/actions/get-lookup-results/get-lookup-results.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import app from "../../epsy.app.mjs";

export default {
key: "epsy-get-lookup-results",
name: "Get Lookup Results",
description: "Get the results of the lookup with the provided ID. [See the documentation](https://irbis.espysys.com/developer/)",
version: "0.0.1",
type: "action",
props: {
app,
value: {
propDefinition: [
app,
"value",
],
},
searchId: {
propDefinition: [
app,
"searchId",
],
},
},

async run({ $ }) {
const response = await this.app.getLookupResults({
$,
searchId: this.searchId,
data: {
value: this.value,
},
params: {
key: `${this.app.$auth.api_key}`,
},
});
$.export("$summary", `Successfully retrieved the details of the request with ID: '${this.searchId}'`);
return response;
},
};
30 changes: 30 additions & 0 deletions components/epsy/actions/name-lookup/name-lookup.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import app from "../../epsy.app.mjs";

export default {
key: "epsy-name-lookup",
name: "Name Lookup",
description: "Request a lookup for the provided name. [See the documentation](https://irbis.espysys.com/developer/)",
version: "0.0.1",
type: "action",
props: {
app,
value: {
propDefinition: [
app,
"value",
],
},
},

async run({ $ }) {
const response = await this.app.nameLookup({
$,
data: {
value: this.value,
lookupId: 149,
},
});
$.export("$summary", `Successfully sent request. Use the ID to get the results: '${response.id}'`);
return response;
},
};
95 changes: 90 additions & 5 deletions components/epsy/epsy.app.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,96 @@
import { axios } from "@pipedream/platform";

export default {
type: "app",
app: "epsy",
propDefinitions: {},
propDefinitions: {
value: {
type: "string",
label: "Value",
description: "Value to lookup",
},
searchId: {
type: "string",
label: "Search ID",
description: "ID of the search",
async options() {
const response = await this.getSearchIds();
const searchIds = response.list;
return searchIds.map(({ id }) => ({
value: id,
}));
},
},
},
methods: {
// this.$auth contains connected account data
authKeys() {
console.log(Object.keys(this.$auth));
_baseUrl() {
return "https://irbis.espysys.com/api";
},
async _makeRequest(opts = {}) {
const {
$ = this,
path,
headers,
data,
...otherOpts
} = opts;
console.log("Request Options:", {
url: this._baseUrl() + path,
headers: {
...headers,
"accept": "application/json",
"content-type": "application/json",
},
data: {
...data,
key: `${this.$auth.api_key}`,
},
...otherOpts,
});
return axios($, {
...otherOpts,
url: this._baseUrl() + path,
headers: {
...headers,
"accept": "application/json",
"content-type": "application/json",
},
data: {
...data,
key: `${this.$auth.api_key}`,
},
});
},
async emailLookup(args = {}) {
return this._makeRequest({
path: "/developer/combined_email",
method: "post",
...args,
});
},
async nameLookup(args = {}) {
return this._makeRequest({
path: "/developer/combined_name",
method: "post",
...args,
});
},
async getLookupResults({
searchId, ...args
}) {
return this._makeRequest({
path: `/request-monitor/api-usage/${searchId}`,
...args,
});
},
async getSearchIds(args = {}) {
return this._makeRequest({
path: "/request-monitor/api-usage",
params: {
key: `${this.$auth.api_key}`,
},
...args,
});
},
},
};
};
7 changes: 5 additions & 2 deletions components/epsy/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/epsy",
"version": "0.0.1",
"version": "0.1.0",
"description": "Pipedream Epsy Components",
"main": "epsy.app.mjs",
"keywords": [
Expand All @@ -11,5 +11,8 @@
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
"publishConfig": {
"access": "public"
},
"dependencies": {
"@pipedream/platform": "^3.0.3"
}
}
}
6 changes: 5 additions & 1 deletion pnpm-lock.yaml

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

Loading