Skip to content

Commit 31f21c9

Browse files
authored
Merging pull request #16948
* Added actions * Added actions * Added actions
1 parent b80bd24 commit 31f21c9

File tree

8 files changed

+121
-4
lines changed

8 files changed

+121
-4
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import app from "../../parsehub.app.mjs";
2+
3+
export default {
4+
key: "parsehub-cancel-run",
5+
name: "Cancel Run",
6+
description: "Cancels a run and changes its status to cancelled. [See the documentation](https://www.parsehub.com/docs/ref/api/v2/#cancel-a-run)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
app,
11+
runToken: {
12+
propDefinition: [
13+
app,
14+
"runToken",
15+
],
16+
},
17+
},
18+
async run({ $ }) {
19+
const response = await this.app.cancelRun({
20+
$,
21+
runToken: this.runToken,
22+
});
23+
$.export("$summary", "Successfully cancelled the run with token: " + this.runToken);
24+
return response;
25+
},
26+
};
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import app from "../../parsehub.app.mjs";
2+
3+
export default {
4+
key: "parsehub-delete-run",
5+
name: "Delete Run",
6+
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)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
app,
11+
runToken: {
12+
propDefinition: [
13+
app,
14+
"runToken",
15+
],
16+
},
17+
},
18+
async run({ $ }) {
19+
const response = await this.app.deleteRun({
20+
$,
21+
runToken: this.runToken,
22+
});
23+
$.export("$summary", "Successfully deleted the run with token: " + this.runToken);
24+
return response;
25+
},
26+
};

components/parsehub/actions/get-data-run/get-data-run.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "parsehub-get-data-run",
55
name: "Get Data for a Run",
66
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)",
7-
version: "0.0.2",
7+
version: "0.0.3",
88
type: "action",
99
props: {
1010
app,

components/parsehub/actions/get-project/get-project.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "parsehub-get-project",
55
name: "Get Project Details",
66
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)",
7-
version: "0.0.2",
7+
version: "0.0.3",
88
type: "action",
99
props: {
1010
app,
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import app from "../../parsehub.app.mjs";
2+
3+
export default {
4+
key: "parsehub-get-projects",
5+
name: "Get Projects",
6+
description: "Lists all projects in your account [See the documentation](https://www.parsehub.com/docs/ref/api/v2/#list-all-projects)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
app,
11+
offset: {
12+
propDefinition: [
13+
app,
14+
"offset",
15+
],
16+
},
17+
limit: {
18+
propDefinition: [
19+
app,
20+
"limit",
21+
],
22+
},
23+
},
24+
async run({ $ }) {
25+
const response = await this.app.listProjects({
26+
$,
27+
params: {
28+
offset: this.offset,
29+
limit: this.limit,
30+
},
31+
});
32+
$.export("$summary", "Successfully listed your projects");
33+
return response;
34+
},
35+
};

components/parsehub/actions/run-project/run-project.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export default {
44
key: "parsehub-run-project",
55
name: "Run Parsehub Project",
66
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)",
7-
version: "0.0.2",
7+
version: "0.0.3",
88
type: "action",
99
props: {
1010
app,

components/parsehub/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/parsehub",
3-
"version": "0.1.1",
3+
"version": "0.2.0",
44
"description": "Pipedream ParseHub Components",
55
"main": "parsehub.app.mjs",
66
"keywords": [

components/parsehub/parsehub.app.mjs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,18 @@ export default {
2929
label: "Start URL",
3030
description: "The url to start running on",
3131
},
32+
offset: {
33+
type: "string",
34+
label: "Offset",
35+
description: "Specifies the offset from which to start listing the projects",
36+
optional: true,
37+
},
38+
limit: {
39+
type: "string",
40+
label: "Limit",
41+
description: "Specifies how many entries will be returned in the list",
42+
optional: true,
43+
},
3244
},
3345
methods: {
3446
_baseUrl() {
@@ -81,5 +93,23 @@ export default {
8193
...args,
8294
});
8395
},
96+
async cancelRun({
97+
runToken, ...args
98+
}) {
99+
return this._makeRequest({
100+
path: `/runs/${runToken}/cancel`,
101+
method: "post",
102+
...args,
103+
});
104+
},
105+
async deleteRun({
106+
runToken, ...args
107+
}) {
108+
return this._makeRequest({
109+
path: `/runs/${runToken}`,
110+
method: "delete",
111+
...args,
112+
});
113+
},
84114
},
85115
};

0 commit comments

Comments
 (0)