Skip to content

Commit 9ab0c77

Browse files
committed
jigsawstack init
1 parent f3dfbba commit 9ab0c77

File tree

5 files changed

+161
-4
lines changed

5 files changed

+161
-4
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import jigsawstack from "../../jigsawstack.app.mjs";
2+
import { axios } from "@pipedream/platform";
3+
4+
export default {
5+
key: "jigsawstack-object-detection",
6+
name: "Object Detection",
7+
description: "Recognize objects within a provided image and retrieve it with great accuracy. [See the documentation](https://docs.jigsawstack.com/api-reference/ai/object-detection)",
8+
version: "0.0.{{ts}}",
9+
type: "action",
10+
props: {
11+
jigsawstack,
12+
imageUrl: {
13+
propDefinition: [
14+
jigsawstack,
15+
"imageUrl",
16+
],
17+
},
18+
},
19+
async run({ $ }) {
20+
const response = await this.jigsawstack.detectObjectsInImage({
21+
imageUrl: this.imageUrl,
22+
});
23+
$.export("$summary", "Successfully detected objects in the image");
24+
return response;
25+
},
26+
};
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import jigsawstack from "../../jigsawstack.app.mjs";
2+
import { axios } from "@pipedream/platform";
3+
4+
export default {
5+
key: "jigsawstack-sentiment-analysis",
6+
name: "Sentiment Analysis",
7+
description: "Assess sentiment of a provided text. Vibes can be positive, negative, or neutral. [See the documentation](https://docs.jigsawstack.com/api-reference/ai/sentiment)",
8+
version: "0.0.{{ts}}",
9+
type: "action",
10+
props: {
11+
jigsawstack,
12+
text: {
13+
propDefinition: [
14+
jigsawstack,
15+
"text",
16+
],
17+
},
18+
},
19+
async run({ $ }) {
20+
const response = await this.jigsawstack.analyzeSentiment({
21+
text: this.text,
22+
});
23+
24+
$.export("$summary", `Successfully analyzed sentiment with emotion: ${response.sentiment.emotion} and sentiment: ${response.sentiment.sentiment}`);
25+
return response;
26+
},
27+
};
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
import jigsawstack from "../../jigsawstack.app.mjs";
2+
import { axios } from "@pipedream/platform";
3+
4+
export default {
5+
key: "jigsawstack-verify-email",
6+
name: "Verify Email",
7+
description: "Validate any email address and determine deliverability as well as disposable status. [See the documentation](https://docs.jigsawstack.com/api-reference/validate/email)",
8+
version: "0.0.{{ts}}",
9+
type: "action",
10+
props: {
11+
jigsawstack,
12+
email: {
13+
propDefinition: [
14+
jigsawstack,
15+
"email",
16+
],
17+
},
18+
},
19+
async run({ $ }) {
20+
const response = await this.jigsawstack.validateEmail({
21+
email: this.email,
22+
});
23+
24+
$.export("$summary", `Successfully validated email: ${this.email}`);
25+
return response;
26+
},
27+
};
Lines changed: 80 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,88 @@
1+
import { axios } from "@pipedream/platform";
2+
13
export default {
24
type: "app",
35
app: "jigsawstack",
4-
propDefinitions: {},
6+
propDefinitions: {
7+
email: {
8+
type: "string",
9+
label: "Email Address",
10+
description: "The email address to validate.",
11+
},
12+
imageUrl: {
13+
type: "string",
14+
label: "Image URL",
15+
description: "The URL of the image to process.",
16+
},
17+
text: {
18+
type: "string",
19+
label: "Text",
20+
description: "The text to analyze for sentiment.",
21+
},
22+
},
523
methods: {
6-
// this.$auth contains connected account data
24+
_baseUrl() {
25+
return "https://api.jigsawstack.com";
26+
},
27+
async _makeRequest(opts = {}) {
28+
const {
29+
$ = this,
30+
method = "GET",
31+
path = "/",
32+
headers,
33+
...otherOpts
34+
} = opts;
35+
return axios($, {
36+
...otherOpts,
37+
method,
38+
url: this._baseUrl() + path,
39+
headers: {
40+
...headers,
41+
"x-api-key": this.$auth.api_key,
42+
},
43+
});
44+
},
45+
async validateEmail(opts = {}) {
46+
const {
47+
email, ...otherOpts
48+
} = opts;
49+
return this._makeRequest({
50+
method: "GET",
51+
path: "/v1/validate/email",
52+
params: {
53+
email,
54+
},
55+
...otherOpts,
56+
});
57+
},
58+
async detectObjectsInImage(opts = {}) {
59+
const {
60+
imageUrl, ...otherOpts
61+
} = opts;
62+
return this._makeRequest({
63+
method: "POST",
64+
path: "/v1/ai/object_detection",
65+
data: {
66+
url: imageUrl,
67+
},
68+
...otherOpts,
69+
});
70+
},
71+
async analyzeSentiment(opts = {}) {
72+
const {
73+
text, ...otherOpts
74+
} = opts;
75+
return this._makeRequest({
76+
method: "POST",
77+
path: "/v1/ai/sentiment",
78+
data: {
79+
text,
80+
},
81+
...otherOpts,
82+
});
83+
},
784
authKeys() {
885
console.log(Object.keys(this.$auth));
986
},
1087
},
11-
};
88+
};

components/jigsawstack/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@
1212
"publishConfig": {
1313
"access": "public"
1414
}
15-
}
15+
}

0 commit comments

Comments
 (0)