-
Notifications
You must be signed in to change notification settings - Fork 5.6k
[Components] hypeauditor #14942 #15288
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| import app from "../../hypeauditor.app.mjs"; | ||
| import { ConfigurationError } from "@pipedream/platform"; | ||
|
|
||
| export default { | ||
| key: "hypeauditor-get-instagram-report", | ||
| name: "Get Instagram Report", | ||
| description: "Returns a report about the specified Instagram user. [See the documentation](https://hypeauditor.readme.io/reference/report_instagram#requests)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| username: { | ||
| propDefinition: [ | ||
| app, | ||
| "username", | ||
| ], | ||
| }, | ||
| userId: { | ||
| propDefinition: [ | ||
| app, | ||
| "userId", | ||
| ], | ||
| }, | ||
| }, | ||
|
|
||
| async run({ $ }) { | ||
| if (!this.userId && !this.username) { | ||
| throw new ConfigurationError("You need to inform a Channel ID or Channel Username"); | ||
| } | ||
|
|
||
| const response = await this.app.getInstagramReport({ | ||
| $, | ||
| params: { | ||
| username: this.userId ?? this.username, | ||
| v: "2", | ||
| }, | ||
|
|
||
| }); | ||
|
|
||
| $.export("$summary", `Successfully sent the request. Report state: '${response.result.report_state}'`); | ||
|
|
||
| return response; | ||
| }, | ||
| }; | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,31 @@ | ||||||||||||||||||
| import app from "../../hypeauditor.app.mjs"; | ||||||||||||||||||
|
|
||||||||||||||||||
| export default { | ||||||||||||||||||
| key: "hypeauditor-get-tiktok-report", | ||||||||||||||||||
| name: "Get Tiktok Report", | ||||||||||||||||||
| description: "Returns a report about the specified Tiktok channel. [See the documentation](https://hypeauditor.readme.io/reference/get_report_tiktok)", | ||||||||||||||||||
| version: "0.0.1", | ||||||||||||||||||
| type: "action", | ||||||||||||||||||
| props: { | ||||||||||||||||||
| app, | ||||||||||||||||||
| channelUsername: { | ||||||||||||||||||
| propDefinition: [ | ||||||||||||||||||
| app, | ||||||||||||||||||
| "channelUsername", | ||||||||||||||||||
| ], | ||||||||||||||||||
| optional: false, | ||||||||||||||||||
| }, | ||||||||||||||||||
| }, | ||||||||||||||||||
|
|
||||||||||||||||||
| async run({ $ }) { | ||||||||||||||||||
| const response = await this.app.getTiktokReport({ | ||||||||||||||||||
| $, | ||||||||||||||||||
| data: { | ||||||||||||||||||
| channel: this.channelUsername, | ||||||||||||||||||
| }, | ||||||||||||||||||
| }); | ||||||||||||||||||
|
Comment on lines
+23
to
+26
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Inconsistent parameter handling in TikTok report. The TikTok report uses - data: {
+ params: {
channel: this.channelUsername,
},📝 Committable suggestion
Suggested change
|
||||||||||||||||||
| $.export("$summary", `Successfully sent the request. Report state: '${response.result.report_state}'`); | ||||||||||||||||||
|
|
||||||||||||||||||
| return response; | ||||||||||||||||||
| }, | ||||||||||||||||||
| }; | ||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,42 @@ | ||||||||||||||
| import app from "../../hypeauditor.app.mjs"; | ||||||||||||||
| import { ConfigurationError } from "@pipedream/platform"; | ||||||||||||||
|
|
||||||||||||||
| export default { | ||||||||||||||
| key: "hypeauditor-get-youtube-report", | ||||||||||||||
| name: "Get Youtube Report", | ||||||||||||||
| description: "Returns a report about the specified Youtube channel. [See the documentation](https://hypeauditor.readme.io/reference/report_youtube)", | ||||||||||||||
| version: "0.0.1", | ||||||||||||||
| type: "action", | ||||||||||||||
| props: { | ||||||||||||||
| app, | ||||||||||||||
| channelId: { | ||||||||||||||
| propDefinition: [ | ||||||||||||||
| app, | ||||||||||||||
| "channelId", | ||||||||||||||
| ], | ||||||||||||||
| }, | ||||||||||||||
| channelUsername: { | ||||||||||||||
| propDefinition: [ | ||||||||||||||
| app, | ||||||||||||||
| "channelUsername", | ||||||||||||||
| ], | ||||||||||||||
| }, | ||||||||||||||
| }, | ||||||||||||||
|
|
||||||||||||||
| async run({ $ }) { | ||||||||||||||
| if (!this.channelId && !this.channelUsername) { | ||||||||||||||
| throw new ConfigurationError("You need to inform a Channel ID or Channel Username"); | ||||||||||||||
| } | ||||||||||||||
|
|
||||||||||||||
| const response = await this.app.getYoutubeReport({ | ||||||||||||||
| $, | ||||||||||||||
| data: { | ||||||||||||||
| channel: this.channelId ?? this.channelUsername, | ||||||||||||||
| }, | ||||||||||||||
|
Comment on lines
+33
to
+35
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Inconsistent parameter handling between actions. The YouTube report uses - data: {
+ params: {
channel: this.channelId ?? this.channelUsername,
},📝 Committable suggestion
Suggested change
|
||||||||||||||
| }); | ||||||||||||||
|
|
||||||||||||||
| $.export("$summary", `Successfully sent the request. Report state: '${response.result.report_state}'`); | ||||||||||||||
|
|
||||||||||||||
| return response; | ||||||||||||||
| }, | ||||||||||||||
| }; | ||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,11 +1,77 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { axios } from "@pipedream/platform"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export default { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| type: "app", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| app: "hypeauditor", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| propDefinitions: {}, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| propDefinitions: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| username: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| type: "string", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| label: "Username", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| description: "Username to request the report", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| optional: true, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| userId: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| type: "string", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| label: "User ID", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| description: "User ID to request the report", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| optional: true, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| channelUsername: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| type: "string", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| label: "Channel Username", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| description: "Identify the user by their Channel Username", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| optional: true, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| channelId: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| type: "string", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| label: "Channel ID", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| description: "Identify the user by their Channel ID", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| optional: true, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| methods: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // this.$auth contains connected account data | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| authKeys() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| console.log(Object.keys(this.$auth)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| _baseUrl() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return "https://hypeauditor.com/api/method"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| async _makeRequest(opts = {}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| $ = this, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| path, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| headers, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ...otherOpts | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } = opts; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return axios($, { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ...otherOpts, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| url: this._baseUrl() + path, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| headers: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ...headers, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "content-type": "application/x-www-form-urlencoded", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "x-auth-id": `${this.$auth.client_id}`, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "x-auth-token": `${this.$auth.api_token}`, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| "user-agent": "pipedream/1", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+36
to
+54
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Add error handling and request timeout. The async _makeRequest(opts = {}) {
const {
$ = this,
path,
headers,
+ timeout = 10000,
...otherOpts
} = opts;
- return axios($, {
- ...otherOpts,
- url: this._baseUrl() + path,
- headers: {
- ...headers,
- "content-type": "application/x-www-form-urlencoded",
- "x-auth-id": `${this.$auth.client_id}`,
- "x-auth-token": `${this.$auth.api_token}`,
- "user-agent": "pipedream/1",
- },
- });
+ try {
+ return await axios($, {
+ ...otherOpts,
+ url: this._baseUrl() + path,
+ timeout,
+ headers: {
+ ...headers,
+ "content-type": "application/x-www-form-urlencoded",
+ "x-auth-id": `${this.$auth.client_id}`,
+ "x-auth-token": `${this.$auth.api_token}`,
+ "user-agent": "pipedream/1",
+ },
+ });
+ } catch (err) {
+ const statusCode = err.response?.status;
+ const message = err.response?.data?.message || err.message;
+ throw new Error(`HypeAuditor API request failed: ${statusCode} - ${message}`);
+ }
},📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| async getInstagramReport(args = {}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return this._makeRequest({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| path: "/auditor.report/", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| method: "post", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ...args, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| async getYoutubeReport(args = {}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return this._makeRequest({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| path: "/auditor.youtube/", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| method: "post", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ...args, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| async getTiktokReport(args = {}) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return this._makeRequest({ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| path: "/auditor.tiktok", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| method: "post", | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ...args, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+69
to
+74
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Fix inconsistent path format in getTiktokReport. The async getTiktokReport(args = {}) {
return this._makeRequest({
- path: "/auditor.tiktok",
+ path: "/auditor.tiktok/",
method: "post",
...args,
});📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,6 +1,6 @@ | ||
| { | ||
| "name": "@pipedream/hypeauditor", | ||
| "version": "0.0.1", | ||
| "version": "0.1.0", | ||
| "description": "Pipedream HypeAuditor Components", | ||
| "main": "hypeauditor.app.mjs", | ||
| "keywords": [ | ||
|
|
@@ -11,5 +11,8 @@ | |
| "author": "Pipedream <support@pipedream.com> (https://pipedream.com/)", | ||
| "publishConfig": { | ||
| "access": "public" | ||
| }, | ||
| "dependencies": { | ||
| "@pipedream/platform": "^3.0.3" | ||
| } | ||
|
Comment on lines
+15
to
17
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Update the lock file to include the new dependency. The pipeline is failing because the lock file (pnpm-lock.yaml) is out of sync with package.json. The new dependency Run the following commands to fix this: pnpm install
git add pnpm-lock.yaml
git commit -m "chore: update lock file for @pipedream/platform dependency"🧰 Tools🪛 GitHub Actions: Pull Request Checks[error] Lock file (pnpm-lock.yaml) is out of sync with package.json. Package @pipedream/platform@^3.0.3 is specified in package.json but not in lockfile. 🪛 GitHub Actions: Components Checks[error] Lockfile (pnpm-lock.yaml) is out of sync with package.json. Package @pipedream/platform@^3.0.3 is missing in lockfile. |
||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.