diff --git a/components/apiverve/actions/dns-lookup/dns-lookup.mjs b/components/apiverve/actions/dns-lookup/dns-lookup.mjs new file mode 100644 index 0000000000000..1c3d63eb1e82b --- /dev/null +++ b/components/apiverve/actions/dns-lookup/dns-lookup.mjs @@ -0,0 +1,30 @@ +import apiverve from "../../apiverve.app.mjs"; + +export default { + key: "apiverve-dns-lookup", + name: "DNS Lookup", + description: "Look up the DNS records of a domain. [See the documentation](https://docs.apiverve.com/api/dnslookup)", + version: "0.0.1", + type: "action", + props: { + apiverve, + domain: { + propDefinition: [ + apiverve, + "domain", + ], + }, + }, + async run({ $ }) { + const response = await this.apiverve.dnsLookup({ + $, + params: { + domain: this.domain, + }, + }); + if (response?.status === "ok") { + $.export("$summary", `Successfully retrieved DNS records for ${this.domain}`); + } + return response; + }, +}; diff --git a/components/apiverve/actions/get-dictionary-definition/get-dictionary-definition.mjs b/components/apiverve/actions/get-dictionary-definition/get-dictionary-definition.mjs new file mode 100644 index 0000000000000..2fa616e8ef003 --- /dev/null +++ b/components/apiverve/actions/get-dictionary-definition/get-dictionary-definition.mjs @@ -0,0 +1,29 @@ +import apiverve from "../../apiverve.app.mjs"; + +export default { + key: "apiverve-get-dictionary-definition", + name: "Get Dictionary Definition", + description: "Get the definition of a word. [See the documentation](https://docs.apiverve.com/api/dictionary)", + version: "0.0.1", + type: "action", + props: { + apiverve, + word: { + type: "string", + label: "Word", + description: "The word for which you want to get the definition (e.g., apple)", + }, + }, + async run({ $ }) { + const response = await this.apiverve.getDictionaryDefinition({ + $, + params: { + word: this.word, + }, + }); + if (response?.status === "ok") { + $.export("$summary", `Successfully retrieved definition of ${this.word}`); + } + return response; + }, +}; diff --git a/components/apiverve/actions/get-weather/get-weather.mjs b/components/apiverve/actions/get-weather/get-weather.mjs new file mode 100644 index 0000000000000..9f2fab421ad77 --- /dev/null +++ b/components/apiverve/actions/get-weather/get-weather.mjs @@ -0,0 +1,56 @@ +import apiverve from "../../apiverve.app.mjs"; + +export default { + key: "apiverve-get-weather", + name: "Get Weather", + description: "Return the temperature, humidity, and more for a given location. [See the documentation](https://docs.apiverve.com/api/weatherforecast)", + version: "0.0.1", + type: "action", + props: { + apiverve, + lookupType: { + type: "string", + label: "Lookup Type", + description: "Whether to search by city or zip code", + options: [ + "city", + "zip code", + ], + reloadProps: true, + }, + }, + additionalProps() { + const props = {}; + if (!this.lookupType) { + return props; + } + if (this.lookupType === "city") { + props.city = { + type: "string", + label: "City", + description: "The city for which you want to get the current weather (e.g., San Francisco)", + }; + } + if (this.lookupType === "zip code") { + props.zip = { + type: "string", + label: "Zip Code", + description: "The zip code for which you want to get the current weather (e.g., 64082)", + }; + } + return props; + }, + async run({ $ }) { + const response = await this.apiverve.getWeather({ + $, + params: { + city: this.city, + zip: this.zip, + }, + }); + if (response?.status === "ok") { + $.export("$summary", `Successfully retrieved weather for ${this.city || this.zip}`); + } + return response; + }, +}; diff --git a/components/apiverve/actions/ip-blacklist-lookup/ip-blacklist-lookup.mjs b/components/apiverve/actions/ip-blacklist-lookup/ip-blacklist-lookup.mjs new file mode 100644 index 0000000000000..28ccaa2598a08 --- /dev/null +++ b/components/apiverve/actions/ip-blacklist-lookup/ip-blacklist-lookup.mjs @@ -0,0 +1,29 @@ +import apiverve from "../../apiverve.app.mjs"; + +export default { + key: "apiverve-ip-blacklist-lookup", + name: "IP Blacklist Lookup", + description: "Lookup if an IP address is in a blacklist. [See the documentation](https://docs.apiverve.com/api/ipblacklistlookup)", + version: "0.0.1", + type: "action", + props: { + apiverve, + ip: { + type: "string", + label: "IP Address", + description: "The IP address to lookup in the blacklist (e.g., 201.23.192.173)", + }, + }, + async run({ $ }) { + const response = await this.apiverve.ipBlacklistLookup({ + $, + params: { + ip: this.ip, + }, + }); + if (response?.status === "ok") { + $.export("$summary", `Successfully retrieved data for ${this.ip}`); + } + return response; + }, +}; diff --git a/components/apiverve/actions/moon-phases/moon-phases.mjs b/components/apiverve/actions/moon-phases/moon-phases.mjs new file mode 100644 index 0000000000000..96412e4c85c8b --- /dev/null +++ b/components/apiverve/actions/moon-phases/moon-phases.mjs @@ -0,0 +1,29 @@ +import apiverve from "../../apiverve.app.mjs"; + +export default { + key: "apiverve-moon-phases", + name: "Moon Phases", + description: "Retrieve the moon phase for a given date. [See the documentation](https://docs.apiverve.com/api/moonphases)", + version: "0.0.1", + type: "action", + props: { + apiverve, + date: { + type: "string", + label: "Date", + description: "The date for which you want to get the moon phase (e.g., MM-DD-YYYY : 01-01-2022)", + }, + }, + async run({ $ }) { + const response = await this.apiverve.moonPhases({ + $, + params: { + date: this.date, + }, + }); + if (response?.status === "ok") { + $.export("$summary", `Successfully retrieved moon phases for ${this.date}`); + } + return response; + }, +}; diff --git a/components/apiverve/actions/number-to-words/number-to-words.mjs b/components/apiverve/actions/number-to-words/number-to-words.mjs new file mode 100644 index 0000000000000..cd8a9af60b9f9 --- /dev/null +++ b/components/apiverve/actions/number-to-words/number-to-words.mjs @@ -0,0 +1,29 @@ +import apiverve from "../../apiverve.app.mjs"; + +export default { + key: "apiverve-number-to-words", + name: "Number to Words", + description: "A simple tool for converting numbers to words. Returns the number in words. [See the documentation](https://docs.apiverve.com/api/numbertowords)", + version: "0.0.1", + type: "action", + props: { + apiverve, + number: { + type: "string", + label: "Number", + description: "The number to convert to words", + }, + }, + async run({ $ }) { + const response = await this.apiverve.numberToWords({ + $, + params: { + number: this.number, + }, + }); + if (response?.status === "ok") { + $.export("$summary", "Successfully converted number to words"); + } + return response; + }, +}; diff --git a/components/apiverve/actions/phone-number-validator/phone-number-validator.mjs b/components/apiverve/actions/phone-number-validator/phone-number-validator.mjs new file mode 100644 index 0000000000000..9091487b46dfb --- /dev/null +++ b/components/apiverve/actions/phone-number-validator/phone-number-validator.mjs @@ -0,0 +1,35 @@ +import apiverve from "../../apiverve.app.mjs"; + +export default { + key: "apiverve-phone-number-validator", + name: "Phone Number Validator", + description: "Check whether a phone number is valid or not. [See the documentation](https://docs.apiverve.com/api/phonenumbervalidator)", + version: "0.0.1", + type: "action", + props: { + apiverve, + number: { + type: "string", + label: "Phone Number", + description: "The phone number to validate", + }, + country: { + type: "string", + label: "Country", + description: "The country code of the phone number (e.g., us, uk)", + }, + }, + async run({ $ }) { + const response = await this.apiverve.phoneNumberValidator({ + $, + params: { + number: this.number, + country: this.country, + }, + }); + if (response?.status === "ok") { + $.export("$summary", `Successfully retrieved validation info for ${this.number}`); + } + return response; + }, +}; diff --git a/components/apiverve/actions/routing-number-lookup/routing-number-lookup.mjs b/components/apiverve/actions/routing-number-lookup/routing-number-lookup.mjs new file mode 100644 index 0000000000000..4b5330235e673 --- /dev/null +++ b/components/apiverve/actions/routing-number-lookup/routing-number-lookup.mjs @@ -0,0 +1,29 @@ +import apiverve from "../../apiverve.app.mjs"; + +export default { + key: "apiverve-routing-number-lookup", + name: "Routing Number Lookup", + description: "Lookup routing number information for USA Banks. [See the documentation](https://docs.apiverve.com/api/routinglookup)", + version: "0.0.1", + type: "action", + props: { + apiverve, + routing: { + type: "string", + label: "Routing Number", + description: "The routing number to lookup information about (e.g., 121000358)", + }, + }, + async run({ $ }) { + const response = await this.apiverve.routingNumberLookup({ + $, + params: { + routing: this.routing, + }, + }); + if (response?.status === "ok") { + $.export("$summary", `Successfully retrieved routing number information for ${this.routing}`); + } + return response; + }, +}; diff --git a/components/apiverve/actions/street-address-parser/street-address-parser.mjs b/components/apiverve/actions/street-address-parser/street-address-parser.mjs new file mode 100644 index 0000000000000..ededdc3cec0dd --- /dev/null +++ b/components/apiverve/actions/street-address-parser/street-address-parser.mjs @@ -0,0 +1,29 @@ +import apiverve from "../../apiverve.app.mjs"; + +export default { + key: "apiverve-street-address-parser", + name: "Street Address Parser", + description: "Parse a US street addresses and return the parsed components of the street address provided. [See the documentation](https://docs.apiverve.com/api/streetaddressparser)", + version: "0.0.1", + type: "action", + props: { + apiverve, + address: { + type: "string", + label: "Address", + description: "The street address to parse", + }, + }, + async run({ $ }) { + const response = await this.apiverve.streetAddressParser({ + $, + params: { + address: this.address, + }, + }); + if (response?.status === "ok") { + $.export("$summary", "Successfully parsed street address"); + } + return response; + }, +}; diff --git a/components/apiverve/actions/whois-lookup/whois-lookup.mjs b/components/apiverve/actions/whois-lookup/whois-lookup.mjs new file mode 100644 index 0000000000000..8d8720aa9cdf4 --- /dev/null +++ b/components/apiverve/actions/whois-lookup/whois-lookup.mjs @@ -0,0 +1,30 @@ +import apiverve from "../../apiverve.app.mjs"; + +export default { + key: "apiverve-whois-lookup", + name: "Whois Lookup", + description: "Check the registration of a domain name. [See the documentation](https://docs.apiverve.com/api/whoislookup)", + version: "0.0.1", + type: "action", + props: { + apiverve, + domain: { + propDefinition: [ + apiverve, + "domain", + ], + }, + }, + async run({ $ }) { + const response = await this.apiverve.whoisLookup({ + $, + params: { + domain: this.domain, + }, + }); + if (response?.status === "ok") { + $.export("$summary", `Successfully retrieved WHOIS records for ${this.domain}`); + } + return response; + }, +}; diff --git a/components/apiverve/apiverve.app.mjs b/components/apiverve/apiverve.app.mjs index be26eb4f60608..85dbffb735289 100644 --- a/components/apiverve/apiverve.app.mjs +++ b/components/apiverve/apiverve.app.mjs @@ -1,11 +1,91 @@ +import { axios } from "@pipedream/platform"; + export default { type: "app", app: "apiverve", - propDefinitions: {}, + propDefinitions: { + domain: { + type: "string", + label: "Domain", + description: "The domain name to lookup. Do not include the protocol, and not subdomains (e.g., myspace.com)", + }, + }, methods: { - // this.$auth contains connected account data - authKeys() { - console.log(Object.keys(this.$auth)); + _baseUrl() { + return "https://api.apiverve.com/v1"; + }, + _makeRequest({ + $ = this, + path, + ...opts + }) { + return axios($, { + url: `${this._baseUrl()}${path}`, + headers: { + "x-api-key": `${this.$auth.api_key}`, + }, + ...opts, + }); + }, + getWeather(opts = {}) { + return this._makeRequest({ + path: "/weatherforecast", + ...opts, + }); + }, + whoisLookup(opts = {}) { + return this._makeRequest({ + path: "/whoislookup", + ...opts, + }); + }, + dnsLookup(opts = {}) { + return this._makeRequest({ + path: "/dnslookup", + ...opts, + }); + }, + numberToWords(opts = {}) { + return this._makeRequest({ + path: "/numbertowords", + ...opts, + }); + }, + moonPhases(opts = {}) { + return this._makeRequest({ + path: "/moonphases", + ...opts, + }); + }, + streetAddressParser(opts = {}) { + return this._makeRequest({ + path: "/streetaddressparser", + ...opts, + }); + }, + ipBlacklistLookup(opts = {}) { + return this._makeRequest({ + path: "/ipblacklistlookup", + ...opts, + }); + }, + routingNumberLookup(opts = {}) { + return this._makeRequest({ + path: "/routinglookup", + ...opts, + }); + }, + getDictionaryDefinition(opts = {}) { + return this._makeRequest({ + path: "/dictionary", + ...opts, + }); + }, + phoneNumberValidator(opts = {}) { + return this._makeRequest({ + path: "/phonenumbervalidator", + ...opts, + }); }, }, -}; \ No newline at end of file +}; diff --git a/components/apiverve/package.json b/components/apiverve/package.json index 9a76f4f049491..4e92f7486a064 100644 --- a/components/apiverve/package.json +++ b/components/apiverve/package.json @@ -1,6 +1,6 @@ { "name": "@pipedream/apiverve", - "version": "0.0.1", + "version": "0.1.0", "description": "Pipedream APIVerve Components", "main": "apiverve.app.mjs", "keywords": [ @@ -11,5 +11,8 @@ "author": "Pipedream (https://pipedream.com/)", "publishConfig": { "access": "public" + }, + "dependencies": { + "@pipedream/platform": "^3.0.3" } -} \ No newline at end of file +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 301177892c3ad..a265b42c29cb1 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -883,7 +883,11 @@ importers: specifier: ^1.1.1 version: 1.6.6 - components/apiverve: {} + components/apiverve: + dependencies: + '@pipedream/platform': + specifier: ^3.0.3 + version: 3.0.3 components/apollo_io: dependencies: