Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import rapidUrlIndexer from "../../rapid_url_indexer.app.mjs";
import fs from "fs";

export default {
key: "rapid_url_indexer-download-project-report",
name: "Download Project Report",
description: "Download the report for a specific project. [See the documentation](https://rapidurlindexer.com/indexing-api/).",
type: "action",
version: "0.0.1",
props: {
rapidUrlIndexer,
projectId: {
propDefinition: [
rapidUrlIndexer,
"projectId",
],
},
filename: {
type: "string",
label: "Filename",
description: "A filename to save the report as in the `/tmp` directory. Include the `.csv` extension",
},
},
async run({ $ }) {
const response = await this.rapidUrlIndexer.downloadProjectReport({
$,
projectId: this.projectId,
});

const filepath = this.filename.includes("/tmp")
? this.filename
: `/tmp/${this.filename}`;

fs.writeFileSync(filepath, response);

$.export("$summary", `Successfully downloaded report for Project with ID ${this.projectId}`);
return filepath;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import rapidUrlIndexer from "../../rapid_url_indexer.app.mjs";

export default {
key: "rapid_url_indexer-get-project-status",
name: "Get Project Status",
description: "Get the status of a specific project. [See the documentation](https://rapidurlindexer.com/indexing-api/).",
type: "action",
version: "0.0.1",
props: {
rapidUrlIndexer,
projectId: {
propDefinition: [
rapidUrlIndexer,
"projectId",
],
},
},
async run({ $ }) {
const response = await this.rapidUrlIndexer.getProjectStatus({
$,
projectId: this.projectId,
});
if (response.id) {
$.export("$summary", `Successfully retrieved status for Project with ID ${response.id}`);
}
return response;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import rapidUrlIndexer from "../../rapid_url_indexer.app.mjs";

export default {
key: "rapid_url_indexer-submit-project",
name: "Submit Poject",
description: "Submit a new project for indexing. [See the documentation](https://rapidurlindexer.com/indexing-api/).",
type: "action",
version: "0.0.1",
props: {
rapidUrlIndexer,
name: {
type: "string",
label: "Project Name",
description: "The name of the project",
},
urls: {
type: "string[]",
label: "URLs",
description: "An array of URLs to index. URLs must start with either “http://” or “https://”.",
},
notifyOnStatusChange: {
type: "string",
label: "Notify on Status Change",
description: "If set to `true`, you will receive email notifications when the project status changes",
optional: true,
},
},
async run({ $ }) {
const response = await this.rapidUrlIndexer.submitProject({
$,
data: {
project_name: this.name,
urls: this.urls,
notify_on_status_change: this.notifyOnStatusChange,
},
});
$.export("$summary", `${response.message}`);
return response;
},
};
7 changes: 5 additions & 2 deletions components/rapid_url_indexer/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/rapid_url_indexer",
"version": "0.0.1",
"version": "0.1.0",
"description": "Pipedream Rapid URL Indexer Components",
"main": "rapid_url_indexer.app.mjs",
"keywords": [
Expand All @@ -11,5 +11,8 @@
"author": "Pipedream <support@pipedream.com> (https://pipedream.com/)",
"publishConfig": {
"access": "public"
},
"dependencies": {
"@pipedream/platform": "^3.0.3"
}
}
}
53 changes: 48 additions & 5 deletions components/rapid_url_indexer/rapid_url_indexer.app.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,54 @@
import { axios } from "@pipedream/platform";

export default {
type: "app",
app: "rapid_url_indexer",
propDefinitions: {},
propDefinitions: {
projectId: {
type: "string",
label: "Project ID",
description: "The identifier of a project",
},
},
methods: {
// this.$auth contains connected account data
authKeys() {
console.log(Object.keys(this.$auth));
_baseUrl() {
return "https://rapidurlindexer.com/wp-json/api/v1";
},
_makeRequest({
$ = this,
path,
...opts
}) {
return axios($, {
url: `${this._baseUrl()}${path}`,
headers: {
"X-API-Key": `${this.$auth.api_key}`,
},
...opts,
});
},
getProjectStatus({
projectId, ...opts
}) {
return this._makeRequest({
path: `/projects/${projectId}`,
...opts,
});
},
downloadProjectReport({
projectId, ...opts
}) {
return this._makeRequest({
path: `/projects/${projectId}/report`,
...opts,
});
},
submitProject(opts = {}) {
return this._makeRequest({
method: "POST",
path: "/projects",
...opts,
});
},
},
};
};
107 changes: 55 additions & 52 deletions pnpm-lock.yaml

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

Loading