Skip to content

Commit 00cf007

Browse files
committed
Merge branch 'master' into 16092-todoist-improvement
2 parents 5869300 + d9f1ce1 commit 00cf007

File tree

321 files changed

+10527
-369
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

321 files changed

+10527
-369
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import adyntel from "../../adyntel.app.mjs";
2+
3+
export default {
4+
key: "adyntel-google-ads-by-company",
5+
name: "Get Google Ads by Company",
6+
description: "Retrieve all Google ads for a given company domain. [See the documentation](https://docs.adyntel.com/ad-libraries/google)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
adyntel,
11+
companyDomain: {
12+
type: "string",
13+
label: "Company Domain",
14+
description: "The company domain. Company domain has to be passed in the 'company.com' format, meaning all prefixes like 'https://' or 'www.' need to be removed.",
15+
},
16+
mediaType: {
17+
type: "string",
18+
label: "Media Type",
19+
description: "Filter results based on media type",
20+
options: [
21+
"text",
22+
"image",
23+
"video",
24+
],
25+
optional: true,
26+
},
27+
},
28+
async run({ $ }) {
29+
const response = await this.adyntel.getGoogleAds({
30+
$,
31+
data: {
32+
company_domain: this.companyDomain,
33+
media_type: this.mediaType,
34+
},
35+
});
36+
$.export("$summary", `Fetched Google Ads for domain ${this.companyDomain}`);
37+
return response;
38+
},
39+
};
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import adyntel from "../../adyntel.app.mjs";
2+
3+
export default {
4+
key: "adyntel-meta-ad-search",
5+
name: "Meta Ad Search",
6+
description: "Searches the Meta ad library. [See the documentation](https://docs.adyntel.com/ad-libraries/meta-ad-search)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
adyntel,
11+
keyword: {
12+
propDefinition: [
13+
adyntel,
14+
"keyword",
15+
],
16+
},
17+
countryCode: {
18+
propDefinition: [
19+
adyntel,
20+
"countryCode",
21+
],
22+
},
23+
},
24+
async run({ $ }) {
25+
const response = await this.adyntel.metaAdSearch({
26+
$,
27+
data: {
28+
keyword: this.keyword,
29+
country_code: this.countryCode,
30+
},
31+
});
32+
$.export("$summary", `Successfully performed Meta ad search with keyword: \`${this.keyword}\`${this.countryCode
33+
? ` and country code: \`${this.countryCode}\``
34+
: ""}`);
35+
return response;
36+
},
37+
};
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import adyntel from "../../adyntel.app.mjs";
2+
3+
export default {
4+
key: "adyntel-tiktok-search",
5+
name: "Search TikTok Ads",
6+
description: "Search TikTok ads using a keyword. [See the documentation](https://docs.adyntel.com/ad-libraries/tiktok-search)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
adyntel,
11+
keyword: {
12+
propDefinition: [
13+
adyntel,
14+
"keyword",
15+
],
16+
},
17+
},
18+
async run({ $ }) {
19+
const response = await this.adyntel.getTiktokAds({
20+
$,
21+
data: {
22+
keyword: this.keyword,
23+
},
24+
});
25+
$.export("$summary", `Successfully retrieved TikTok ads for keyword: \`${this.keyword}\``);
26+
return response;
27+
},
28+
};

components/adyntel/adyntel.app.mjs

Lines changed: 54 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,60 @@
1+
import { axios } from "@pipedream/platform";
2+
13
export default {
24
type: "app",
35
app: "adyntel",
4-
propDefinitions: {},
6+
propDefinitions: {
7+
keyword: {
8+
type: "string",
9+
label: "Keyword",
10+
description: "The keyword to search by",
11+
},
12+
countryCode: {
13+
type: "string",
14+
label: "Country Code",
15+
description: "Use if you want to limit the search to only one country. E.g. `US`",
16+
optional: true,
17+
},
18+
},
519
methods: {
6-
// this.$auth contains connected account data
7-
authKeys() {
8-
console.log(Object.keys(this.$auth));
20+
_baseUrl() {
21+
return "https://api.adyntel.com";
22+
},
23+
_makeRequest({
24+
$ = this,
25+
method = "POST",
26+
path = "/",
27+
data = {},
28+
...otherOpts
29+
}) {
30+
return axios($, {
31+
...otherOpts,
32+
method,
33+
url: `${this._baseUrl()}${path}`,
34+
data: {
35+
...data,
36+
api_key: this.$auth.api_key,
37+
email: this.$auth.username,
38+
},
39+
});
40+
},
41+
metaAdSearch(opts = {}) {
42+
return this._makeRequest({
43+
path: "/facebook_ad_search",
44+
...opts,
45+
});
46+
},
47+
getGoogleAds(opts = {}) {
48+
return this._makeRequest({
49+
path: "/google",
50+
...opts,
51+
});
52+
},
53+
getTiktokAds(opts = {}) {
54+
return this._makeRequest({
55+
path: "/tiktok_search",
56+
...opts,
57+
});
958
},
1059
},
11-
};
60+
};

components/adyntel/package.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pipedream/adyntel",
3-
"version": "0.0.1",
3+
"version": "0.1.0",
44
"description": "Pipedream Adyntel Components",
55
"main": "adyntel.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
}
15-
}
18+
}
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
import agentset from "../../agentset.app.mjs";
2+
import { PAYLOAD_TYPE_OPTIONS } from "../../common/constants.mjs";
3+
import { parseObject } from "../../common/utils.mjs";
4+
5+
export default {
6+
key: "agentset-create-ingest-job",
7+
name: "Create Ingest Job",
8+
description: "Create an ingest job for the authenticated organization. [See the documentation](https://docs.agentset.ai/api-reference/endpoint/ingest-jobs/create)",
9+
version: "0.0.1",
10+
type: "action",
11+
props: {
12+
agentset,
13+
namespaceId: {
14+
propDefinition: [
15+
agentset,
16+
"namespaceId",
17+
],
18+
},
19+
payloadType: {
20+
type: "string",
21+
label: "Payload Type",
22+
description: "Type of payload for the ingest job",
23+
options: PAYLOAD_TYPE_OPTIONS,
24+
reloadProps: true,
25+
},
26+
text: {
27+
type: "string",
28+
label: "Text",
29+
description: "The text to ingest",
30+
hidden: true,
31+
},
32+
fileUrl: {
33+
type: "string",
34+
label: "File URL",
35+
description: "The URL of the file to ingest",
36+
hidden: true,
37+
},
38+
urls: {
39+
type: "string[]",
40+
label: "URLs",
41+
description: "The URLs to ingest",
42+
hidden: true,
43+
},
44+
name: {
45+
type: "string",
46+
label: "Name",
47+
description: "The name of the ingest job",
48+
optional: true,
49+
hidden: true,
50+
},
51+
},
52+
async additionalProps(props) {
53+
props.text.hidden = true;
54+
props.name.hidden = true;
55+
props.fileUrl.hidden = true;
56+
props.urls.hidden = true;
57+
58+
switch (this.payloadType) {
59+
case "TEXT":
60+
props.text.hidden = false;
61+
props.name.hidden = false;
62+
break;
63+
case "FILE":
64+
props.fileUrl.hidden = false;
65+
props.name.hidden = false;
66+
break;
67+
case "URLS":
68+
props.urls.hidden = false;
69+
break;
70+
}
71+
return {};
72+
},
73+
async run({ $ }) {
74+
const payload = {
75+
type: this.payloadType,
76+
};
77+
switch (this.payloadType) {
78+
case "TEXT":
79+
payload.text = this.text;
80+
payload.name = this.name;
81+
break;
82+
case "FILE":
83+
payload.fileUrl = this.fileUrl;
84+
payload.name = this.name;
85+
break;
86+
case "URLS":
87+
payload.urls = parseObject(this.urls);
88+
break;
89+
}
90+
const response = await this.agentset.createIngestJob({
91+
$,
92+
namespaceId: this.namespaceId,
93+
data: {
94+
payload,
95+
},
96+
});
97+
$.export("$summary", `Ingest job created successfully: ID ${response.data.id}`);
98+
return response;
99+
},
100+
};
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import agentset from "../../agentset.app.mjs";
2+
import { slugify } from "../../common/utils.mjs";
3+
4+
export default {
5+
key: "agentset-create-namespace",
6+
name: "Create Namespace",
7+
description: "Creates a namespace for the authenticated organization. [See the documentation](https://docs.agentset.ai/api-reference/endpoint/namespaces/create)",
8+
version: "0.0.1",
9+
type: "action",
10+
props: {
11+
agentset,
12+
name: {
13+
type: "string",
14+
label: "Name",
15+
description: "The name of the namespace to create",
16+
},
17+
},
18+
async run({ $ }) {
19+
const response = await this.agentset.createNamespace({
20+
$,
21+
data: {
22+
name: this.name,
23+
slug: slugify(this.name),
24+
},
25+
});
26+
27+
$.export("$summary", `Successfully created namespace with ID: ${response.data.id}`);
28+
return response;
29+
},
30+
};

0 commit comments

Comments
 (0)