Skip to content

[Components] parsehub #13329 #16948

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
26 changes: 26 additions & 0 deletions components/parsehub/actions/cancel-run/cancel-run.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import app from "../../parsehub.app.mjs";

export default {
key: "parsehub-cancel-run",
name: "Cancel Run",
description: "Cancels a run and changes its status to cancelled. [See the documentation](https://www.parsehub.com/docs/ref/api/v2/#cancel-a-run)",
version: "0.0.1",
type: "action",
props: {
app,
runToken: {
propDefinition: [
app,
"runToken",
],
},
},
async run({ $ }) {
const response = await this.app.cancelRun({
$,
runToken: this.runToken,
});
$.export("$summary", "Successfully cancelled the run with token: " + this.runToken);
return response;
},
};
26 changes: 26 additions & 0 deletions components/parsehub/actions/delete-run/delete-run.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import app from "../../parsehub.app.mjs";

export default {
key: "parsehub-delete-run",
name: "Delete Run",
description: "Cancels a run if running, and deletes the run and its data. [See the documentation](https://www.parsehub.com/docs/ref/api/v2/#delete-a-run)",
version: "0.0.1",
type: "action",
props: {
app,
runToken: {
propDefinition: [
app,
"runToken",
],
},
},
async run({ $ }) {
const response = await this.app.deleteRun({
$,
runToken: this.runToken,
});
$.export("$summary", "Successfully deleted the run with token: " + this.runToken);
return response;
},
};
2 changes: 1 addition & 1 deletion components/parsehub/actions/get-data-run/get-data-run.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "parsehub-get-data-run",
name: "Get Data for a Run",
description: "Returns the data extracted by a specified run. [See the documentation](https://www.parsehub.com/docs/ref/api/v2/#get-data-for-a-run)",
version: "0.0.2",
version: "0.0.3",
type: "action",
props: {
app,
Expand Down
2 changes: 1 addition & 1 deletion components/parsehub/actions/get-project/get-project.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "parsehub-get-project",
name: "Get Project Details",
description: "Retrieves the details of a specified project within the user's account. [See the documentation](https://www.parsehub.com/docs/ref/api/v2/#get-a-project)",
version: "0.0.2",
version: "0.0.3",
type: "action",
props: {
app,
Expand Down
35 changes: 35 additions & 0 deletions components/parsehub/actions/get-projects/get-projects.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import app from "../../parsehub.app.mjs";

export default {
key: "parsehub-get-projects",
name: "Get Projects",
description: "Lists all projects in your account [See the documentation](https://www.parsehub.com/docs/ref/api/v2/#list-all-projects)",
version: "0.0.1",
type: "action",
props: {
app,
offset: {
propDefinition: [
app,
"offset",
],
},
limit: {
propDefinition: [
app,
"limit",
],
},
},
async run({ $ }) {
const response = await this.app.listProjects({
$,
params: {
offset: this.offset,
limit: this.limit,
},
});
$.export("$summary", "Successfully listed your projects");
return response;
},
};
2 changes: 1 addition & 1 deletion components/parsehub/actions/run-project/run-project.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export default {
key: "parsehub-run-project",
name: "Run Parsehub Project",
description: "Initiates an instance of a specified project on the Parsehub cloud. [See the documentation](https://www.parsehub.com/docs/ref/api/v2/#run-a-project)",
version: "0.0.2",
version: "0.0.3",
type: "action",
props: {
app,
Expand Down
2 changes: 1 addition & 1 deletion components/parsehub/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/parsehub",
"version": "0.1.1",
"version": "0.2.0",
"description": "Pipedream ParseHub Components",
"main": "parsehub.app.mjs",
"keywords": [
Expand Down
30 changes: 30 additions & 0 deletions components/parsehub/parsehub.app.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,18 @@ export default {
label: "Start URL",
description: "The url to start running on",
},
offset: {
type: "string",
label: "Offset",
description: "Specifies the offset from which to start listing the projects",
optional: true,
},
limit: {
type: "string",
label: "Limit",
description: "Specifies how many entries will be returned in the list",
optional: true,
},
},
methods: {
_baseUrl() {
Expand Down Expand Up @@ -81,5 +93,23 @@ export default {
...args,
});
},
async cancelRun({
runToken, ...args
}) {
return this._makeRequest({
path: `/runs/${runToken}/cancel`,
method: "post",
...args,
});
},
async deleteRun({
runToken, ...args
}) {
return this._makeRequest({
path: `/runs/${runToken}`,
method: "delete",
...args,
});
},
},
};
2 changes: 2 additions & 0 deletions pnpm-lock.yaml

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

Loading