Skip to content

Commit 3a4becc

Browse files
authored
[Components] genderize #13445 (#16021)
* Adicionando log para o datadog * Bump package.json version
1 parent d4900ad commit 3a4becc

File tree

4 files changed

+68
-6
lines changed

4 files changed

+68
-6
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import app from "../../genderize.app.mjs";
2+
3+
export default {
4+
key: "genderize-get-gender-from-name",
5+
name: "Get Gender From Name",
6+
description: "Check the statistical probability of a name being male or female. [See the documentation](https://genderize.io/documentation#basic-usage)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
app,
11+
name: {
12+
propDefinition: [
13+
app,
14+
"name",
15+
],
16+
},
17+
},
18+
async run({ $ }) {
19+
const response = await this.app.getGenderFromName({
20+
$,
21+
params: {
22+
name: this.name,
23+
},
24+
});
25+
$.export("$summary", `Successfully sent the request. Result: ${response.gender}`);
26+
return response;
27+
},
28+
};
Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,38 @@
1+
import { axios } from "@pipedream/platform";
2+
13
export default {
24
type: "app",
35
app: "genderize",
4-
propDefinitions: {},
6+
propDefinitions: {
7+
name: {
8+
type: "string",
9+
label: "Name",
10+
description: "Name that will be checked",
11+
},
12+
},
513
methods: {
6-
// this.$auth contains connected account data
7-
authKeys() {
8-
console.log(Object.keys(this.$auth));
14+
_baseUrl() {
15+
return "https://api.genderize.io";
16+
},
17+
async _makeRequest(opts = {}) {
18+
const {
19+
$ = this,
20+
params,
21+
...otherOpts
22+
} = opts;
23+
return axios($, {
24+
...otherOpts,
25+
url: this._baseUrl(),
26+
params: {
27+
api_key: `${this.$auth.api_key}`,
28+
...params,
29+
},
30+
});
31+
},
32+
async getGenderFromName(args = {}) {
33+
return this._makeRequest({
34+
...args,
35+
});
936
},
1037
},
1138
};

components/genderize/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/genderize",
3-
"version": "0.0.1",
3+
"version": "0.1.0",
44
"description": "Pipedream Genderize Components",
55
"main": "genderize.app.mjs",
66
"keywords": [
@@ -11,5 +11,8 @@
1111
"author": "Pipedream <[email protected]> (https://pipedream.com/)",
1212
"publishConfig": {
1313
"access": "public"
14+
},
15+
"dependencies": {
16+
"@pipedream/platform": "^3.0.3"
1417
}
1518
}

pnpm-lock.yaml

Lines changed: 5 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)