-
Notifications
You must be signed in to change notification settings - Fork 5.5k
GetScreenshot new components #14070
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
Merged
Merged
GetScreenshot new components #14070
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
f4b2b66
Initial AI-generated code (w/o dead imports)
GTFalcao ffdc378
Package updates
GTFalcao 3db1454
App file adjustments
GTFalcao 7990a5e
Creating 'get account api usage'
GTFalcao f072bad
pnpm
GTFalcao cd22040
Get Website Screenshot action
GTFalcao 191a64f
Syntax fixes
GTFalcao 15784a5
Object fix
GTFalcao 5fb9a56
Request fixes
GTFalcao f1a5fbc
Merge branch 'master' into issue-13268
GTFalcao File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
29 changes: 29 additions & 0 deletions
29
components/getscreenshot/actions/get-account-api-usage/get-account-api-usage.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| import rasterwise from "../../getscreenshot.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "getscreenshot-get-account-api-usage", | ||
| name: "Get Account API Usage", | ||
| description: | ||
| "Retrieve your current API usage and available quota. [See the documentation](https://docs.rasterwise.com/docs/getscreenshot/api-reference-1/)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| rasterwise, | ||
| email: { | ||
| type: "string", | ||
| label: "Email Address", | ||
| description: "The email address of this account.", | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const { | ||
| rasterwise, ...params | ||
| } = this; | ||
| const response = await rasterwise.getApiUsage({ | ||
| $, | ||
| params, | ||
| }); | ||
| $.export("$summary", "Successfully retrieved API usage"); | ||
| return response; | ||
| }, | ||
| }; |
68 changes: 68 additions & 0 deletions
68
components/getscreenshot/actions/get-website-screenshot/get-website-screenshot.mjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| import getscreenshot from "../../getscreenshot.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "getscreenshot-get-website-screenshot", | ||
| name: "Get Website Screenshot", | ||
| description: "Capture a screenshot from a live website. [See the documentation](https://docs.rasterwise.com/docs/getscreenshot/api-reference-0/)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| getscreenshot, | ||
| url: { | ||
| type: "string", | ||
| label: "Website URL", | ||
| description: "URL of the website / page you want to screenshot. Should start with `http://` or `https://`", | ||
| }, | ||
| format: { | ||
| type: "string", | ||
| label: "Image Format", | ||
| description: "The file type/format in which you want to get your capture. If `pdf` is selected, an A4 PDF of the passed website will be generated, rendered the same as if you were printing it from your browser.", | ||
| options: [ | ||
| "png", | ||
| "jpeg", | ||
| "pdf", | ||
| ], | ||
| default: "png", | ||
| optional: true, | ||
| }, | ||
| email: { | ||
| type: "string", | ||
| label: "Email Address", | ||
| description: "If specified, a formatted email will be sent to this email address, including the captured image and details of the capture.", | ||
| optional: true, | ||
| }, | ||
| element: { | ||
| type: "string", | ||
| label: "Element", | ||
| description: "If you need to target specific DOM elements instead of taking dimension-based screenshots, you can specify an element DOM selector, e.g. `#colordiv` to target a div with the id \"colordiv\".", | ||
| optional: true, | ||
| }, | ||
| additionalParams: { | ||
| type: "object", | ||
| label: "Additional Parameters", | ||
| description: "Additional parameters (key/value pairs) to send in this request. [See the documentation](https://docs.rasterwise.com/docs/getscreenshot/api-reference-0/) for all available parameters.", | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const { | ||
| getscreenshot, format, additionalParams, ...params | ||
| } = this; | ||
| const response = await getscreenshot.getScreenshot({ | ||
| $, | ||
| params: { | ||
| ...params, | ||
| ...(format === "pdf" | ||
| ? { | ||
| pdf: true, | ||
| } | ||
| : { | ||
| format, | ||
| }), | ||
| ...additionalParams, | ||
| }, | ||
| }); | ||
| $.export("$summary", `Successfully captured screenshot of "${this.url}"`); | ||
| return response; | ||
| }, | ||
| }; |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| import { axios } from "@pipedream/platform"; | ||
|
|
||
| export default { | ||
| type: "app", | ||
| app: "getscreenshot", | ||
| propDefinitions: {}, | ||
| methods: { | ||
| _baseUrl() { | ||
| return "https://api.rasterwise.com/v1"; | ||
| }, | ||
| async _makeRequest({ | ||
| $, params, ...otherOpts | ||
| }) { | ||
| return axios($, { | ||
| ...otherOpts, | ||
| baseURL: this._baseUrl(), | ||
| params: { | ||
| ...params, | ||
| apikey: this.$auth.api_key, | ||
| }, | ||
| }); | ||
| }, | ||
| async getScreenshot(args) { | ||
| return this._makeRequest({ | ||
| url: "/get-screenshot", | ||
| ...args, | ||
| }); | ||
| }, | ||
| async getApiUsage(args) { | ||
| return this._makeRequest({ | ||
| url: "/usage", | ||
| ...args, | ||
| }); | ||
| }, | ||
| }, | ||
| }; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,18 +1,18 @@ | ||
| { | ||
| "name": "@pipedream/getscreenshot", | ||
| "version": "0.0.3", | ||
| "version": "0.1.0", | ||
| "description": "Pipedream GetScreenshot Components", | ||
| "main": "dist/app/getscreenshot.app.mjs", | ||
| "main": "getscreenshot.app.mjs", | ||
| "keywords": [ | ||
| "pipedream", | ||
| "getscreenshot" | ||
| ], | ||
| "files": [ | ||
| "dist" | ||
| ], | ||
| "homepage": "https://pipedream.com/apps/getscreenshot", | ||
| "author": "Pipedream <[email protected]> (https://pipedream.com/)", | ||
| "publishConfig": { | ||
| "access": "public" | ||
| }, | ||
| "dependencies": { | ||
| "@pipedream/platform": "^3.0.3" | ||
| } | ||
| } |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.