Skip to content

Commit 9b5cf07

Browse files
committed
Initial AI-generated code (partial)
1 parent 4141ea4 commit 9b5cf07

File tree

2 files changed

+123
-2
lines changed

2 files changed

+123
-2
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
import hypeauditor from "../../hypeauditor.app.mjs";
2+
3+
export default {
4+
key: "hypeauditor-get-youtube-report",
5+
name: "Get YouTube Report",
6+
description: "Generates a comprehensive YouTube report for a specified channel. [See the documentation]()",
7+
version: "0.0.{{ts}}",
8+
type: "action",
9+
props: {
10+
hypeauditor,
11+
youtubeChannel: {
12+
propDefinition: [
13+
hypeauditor,
14+
"youtubeChannel",
15+
],
16+
},
17+
youtubeFeatures: {
18+
propDefinition: [
19+
hypeauditor,
20+
"youtubeFeatures",
21+
],
22+
},
23+
},
24+
async run({ $ }) {
25+
const response = await this.hypeauditor.getYouTubeReport({
26+
channel: this.youtubeChannel,
27+
features: this.youtubeFeatures,
28+
});
29+
$.export("$summary", `Successfully generated YouTube report for channel ${this.youtubeChannel}`);
30+
return response;
31+
},
32+
};
Lines changed: 91 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,100 @@
1+
import { axios } from "@pipedream/platform";
2+
13
export default {
24
type: "app",
35
app: "hypeauditor",
4-
propDefinitions: {},
6+
version: "0.0.ts",
7+
propDefinitions: {
8+
youtubeChannel: {
9+
type: "string",
10+
label: "YouTube Channel ID or Username",
11+
description: "The YouTube channel ID or username for which to generate a report.",
12+
},
13+
youtubeFeatures: {
14+
type: "string",
15+
label: "Features List",
16+
description: "Optional list of features to include in the YouTube report.",
17+
optional: true,
18+
},
19+
tiktokUser: {
20+
type: "string",
21+
label: "TikTok User Name or ID",
22+
description: "The TikTok username or ID for which to generate a report.",
23+
},
24+
instagramUser: {
25+
type: "string",
26+
label: "Instagram User Name or ID",
27+
description: "The Instagram username or ID for which to generate a report.",
28+
},
29+
twitchChannel: {
30+
type: "string",
31+
label: "Twitch Channel Username",
32+
description: "The Twitch channel username for which to generate a report.",
33+
},
34+
},
535
methods: {
6-
// this.$auth contains connected account data
736
authKeys() {
837
console.log(Object.keys(this.$auth));
938
},
39+
_baseUrl() {
40+
return "https://hypeauditor.com/api/method/auditor";
41+
},
42+
async _makeRequest(opts = {}) {
43+
const {
44+
$ = this, method = "GET", path = "/", headers = {}, ...otherOpts
45+
} = opts;
46+
return axios($, {
47+
method,
48+
url: `${this._baseUrl()}${path}`,
49+
headers: {
50+
...headers,
51+
"X-Auth-Token": this.$auth.token,
52+
"X-Auth-Id": this.$auth.id,
53+
},
54+
...otherOpts,
55+
});
56+
},
57+
async getYouTubeReport(opts = {}) {
58+
const {
59+
channel, features,
60+
} = opts;
61+
const params = {
62+
channel,
63+
};
64+
if (features) {
65+
params.features = features;
66+
}
67+
return this._makeRequest({
68+
path: "/youtube/",
69+
params,
70+
});
71+
},
72+
async getTikTokReport(opts = {}) {
73+
const { channel } = opts;
74+
return this._makeRequest({
75+
path: "/tiktok/",
76+
params: {
77+
channel,
78+
},
79+
});
80+
},
81+
async getInstagramReport(opts = {}) {
82+
const { channel } = opts;
83+
return this._makeRequest({
84+
path: "/instagram/",
85+
params: {
86+
channel,
87+
},
88+
});
89+
},
90+
async getTwitchReport(opts = {}) {
91+
const { channel } = opts;
92+
return this._makeRequest({
93+
path: "/twitch/",
94+
params: {
95+
channel,
96+
},
97+
});
98+
},
1099
},
11100
};

0 commit comments

Comments
 (0)