-
Notifications
You must be signed in to change notification settings - Fork 5.5k
[Components] goodbits #13479 #16351
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
[Components] goodbits #13479 #16351
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| import app from "../../goodbits.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "goodbits-create-link", | ||
| name: "Create Link", | ||
| description: "Create a new link. [See the documentation](https://support.goodbits.io/article/115-goodbit-api)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| url: { | ||
| propDefinition: [ | ||
| app, | ||
| "url", | ||
| ], | ||
| }, | ||
| title: { | ||
| propDefinition: [ | ||
| app, | ||
| "title", | ||
| ], | ||
| }, | ||
| description: { | ||
| propDefinition: [ | ||
| app, | ||
| "description", | ||
| ], | ||
| }, | ||
| fetchRemoteThumbnailUrl: { | ||
| propDefinition: [ | ||
| app, | ||
| "fetchRemoteThumbnailUrl", | ||
| ], | ||
| }, | ||
| imageCandidates: { | ||
| propDefinition: [ | ||
| app, | ||
| "imageCandidates", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.app.createLink({ | ||
| $, | ||
| data: { | ||
| url: this.url, | ||
| title: this.title, | ||
| description: this.description, | ||
| fetch_remote_thumbnail_url: this.fetchRemoteThumbnailUrl, | ||
| image_candidates: this.imageCandidates, | ||
| }, | ||
| }); | ||
| $.export("$summary", "Successfully created new link"); | ||
| return response; | ||
| }, | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| import app from "../../goodbits.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "goodbits-create-subscriber", | ||
| name: "Create Subscriber", | ||
| description: "Create a new subscriber. [See the documentation](https://support.goodbits.io/article/115-goodbit-api)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| email: { | ||
| propDefinition: [ | ||
| app, | ||
| "email", | ||
| ], | ||
| }, | ||
| firstName: { | ||
| propDefinition: [ | ||
| app, | ||
| "firstName", | ||
| ], | ||
| }, | ||
| lastName: { | ||
| propDefinition: [ | ||
| app, | ||
| "lastName", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.app.createSubscriber({ | ||
| $, | ||
| data: { | ||
| email: this.email, | ||
| first_name: this.firstName, | ||
| last_name: this.lastName, | ||
| }, | ||
| }); | ||
| $.export("$summary", "Successfully created new subscriber named"); | ||
| return response; | ||
| }, | ||
| }; | ||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,35 @@ | ||||||||||||||||||||||||||||||||||||||||||||||
| import app from "../../goodbits.app.mjs"; | ||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||
| export default { | ||||||||||||||||||||||||||||||||||||||||||||||
| key: "goodbits-update-subscriber-status", | ||||||||||||||||||||||||||||||||||||||||||||||
| name: "Update Subscriber Status", | ||||||||||||||||||||||||||||||||||||||||||||||
| description: "Update the status of a subscriber. [See the documentation](https://support.goodbits.io/article/115-goodbit-api)", | ||||||||||||||||||||||||||||||||||||||||||||||
| version: "0.0.1", | ||||||||||||||||||||||||||||||||||||||||||||||
| type: "action", | ||||||||||||||||||||||||||||||||||||||||||||||
| props: { | ||||||||||||||||||||||||||||||||||||||||||||||
| app, | ||||||||||||||||||||||||||||||||||||||||||||||
| email: { | ||||||||||||||||||||||||||||||||||||||||||||||
| propDefinition: [ | ||||||||||||||||||||||||||||||||||||||||||||||
| app, | ||||||||||||||||||||||||||||||||||||||||||||||
| "email", | ||||||||||||||||||||||||||||||||||||||||||||||
| ], | ||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||
| status: { | ||||||||||||||||||||||||||||||||||||||||||||||
| propDefinition: [ | ||||||||||||||||||||||||||||||||||||||||||||||
| app, | ||||||||||||||||||||||||||||||||||||||||||||||
| "status", | ||||||||||||||||||||||||||||||||||||||||||||||
| ], | ||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||
| async run({ $ }) { | ||||||||||||||||||||||||||||||||||||||||||||||
| const response = await this.app.unsubscribeSubscriber({ | ||||||||||||||||||||||||||||||||||||||||||||||
| $, | ||||||||||||||||||||||||||||||||||||||||||||||
| email: this.email, | ||||||||||||||||||||||||||||||||||||||||||||||
| data: { | ||||||||||||||||||||||||||||||||||||||||||||||
| status: this.status, | ||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||
| $.export("$summary", "Successfully uptated subscriber status"); | ||||||||||||||||||||||||||||||||||||||||||||||
| return response; | ||||||||||||||||||||||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||||||||||||||||||||||
|
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. 💡 Verification agent 🧩 Analysis chainFix typo in success message and consider method naming There's a typo in the success message: "uptated" should be "updated". Also, the method name "unsubscribeSubscriber" doesn't fully reflect the action's purpose of updating a subscriber's status (not just unsubscribing). async run({ $ }) {
const response = await this.app.unsubscribeSubscriber({
$,
email: this.email,
data: {
status: this.status,
},
});
- $.export("$summary", "Successfully uptated subscriber status");
+ $.export("$summary", "Successfully updated subscriber status");
return response;
},Verify if the method name in the app file matches the actual functionality: 🏁 Script executed: #!/bin/bash
# Check if the method name in the app file is 'unsubscribeSubscriber' or 'updateSubscriberStatus'
grep -A 10 "unsubscribeSubscriber\|updateSubscriberStatus" components/goodbits/goodbits.app.mjsLength of output: 357 Fix typo in success message and improve method naming
async run({ $ }) {
const response = await this.app.unsubscribeSubscriber({
$,
email: this.email,
data: {
status: this.status,
},
});
- $.export("$summary", "Successfully uptated subscriber status");
+ $.export("$summary", "Successfully updated subscriber status");
return response;
},📝 Committable suggestion
Suggested change
Collaborator
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. typo!
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. @jcortes Yes, there's a typo in the success message! As suggested in my previous comment, changing "uptated" to "updated" in the summary export will fix this issue: - $.export("$summary", "Successfully uptated subscriber status");
+ $.export("$summary", "Successfully updated subscriber status");Would you like me to address any other aspects of the code as well? |
||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| export default { | ||
| STATUS_OPTIONS: [ | ||
| "unsubscribed", | ||
| "cleaned", | ||
| "pending", | ||
| "deleted", | ||
| ], | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,105 @@ | ||
| import { axios } from "@pipedream/platform"; | ||
| import constants from "./common/constants.mjs"; | ||
|
|
||
| export default { | ||
| type: "app", | ||
| app: "goodbits", | ||
| propDefinitions: { | ||
| email: { | ||
| type: "string", | ||
| label: "Email", | ||
| description: "Subscriber's email address", | ||
| }, | ||
| firstName: { | ||
| type: "string", | ||
| label: "First Name", | ||
| description: "Subscriber's first name", | ||
| optional: true, | ||
| }, | ||
| lastName: { | ||
| type: "string", | ||
| label: "Last Name", | ||
| description: "Subscriber's last name", | ||
| optional: true, | ||
| }, | ||
| status: { | ||
| type: "string", | ||
| label: "Status", | ||
| description: "New status of the subscriber", | ||
| options: constants.STATUS_OPTIONS, | ||
| }, | ||
| url: { | ||
| type: "string", | ||
| label: "URL", | ||
| description: "URL of the new link", | ||
| }, | ||
| title: { | ||
| type: "string", | ||
| label: "Title", | ||
| description: "Title associated with the link", | ||
| optional: true, | ||
| }, | ||
| description: { | ||
| type: "string", | ||
| label: "Description", | ||
| description: "Description of the link", | ||
| optional: true, | ||
| }, | ||
| fetchRemoteThumbnailUrl: { | ||
| type: "string", | ||
| label: "Fetch Remote Thumbnail URL", | ||
| description: "URL to fetch a remote thumbnail image", | ||
| optional: true, | ||
| }, | ||
| imageCandidates: { | ||
| type: "string", | ||
| label: "Image Candidates", | ||
| description: "List of candidate image URLs", | ||
| optional: true, | ||
| }, | ||
| }, | ||
| methods: { | ||
| _baseUrl() { | ||
| return "https://app.goodbits.io/api/v1"; | ||
| }, | ||
| async _makeRequest(opts = {}) { | ||
| const { | ||
| $ = this, | ||
| path, | ||
| headers, | ||
| ...otherOpts | ||
| } = opts; | ||
| return axios($, { | ||
| ...otherOpts, | ||
| url: this._baseUrl() + path, | ||
| headers: { | ||
| "Authorization": `${this.$auth.api_key}`, | ||
| ...headers, | ||
| }, | ||
| }); | ||
| }, | ||
jcortes marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| async createSubscriber(args = {}) { | ||
| return this._makeRequest({ | ||
| path: "/subscribers", | ||
| method: "post", | ||
| ...args, | ||
| }); | ||
| }, | ||
| async unsubscribeSubscriber({ | ||
| email, ...args | ||
| }) { | ||
| return this._makeRequest({ | ||
| path: `/subscribers/${email}`, | ||
| method: "put", | ||
| ...args, | ||
| }); | ||
| }, | ||
jcortes marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| async createLink(args = {}) { | ||
| return this._makeRequest({ | ||
| path: "/links", | ||
| method: "post", | ||
| ...args, | ||
| }); | ||
| }, | ||
| }, | ||
| }; | ||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,16 +1,18 @@ | ||||||
| { | ||||||
| "name": "@pipedream/goodbits", | ||||||
| "version": "0.0.2", | ||||||
| "version": "0.0.1", | ||||||
|
Collaborator
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.
Suggested change
|
||||||
| "description": "Pipedream Goodbits Components", | ||||||
| "main": "dist/app/goodbits.app.mjs", | ||||||
| "main": "goodbits.app.mjs", | ||||||
| "keywords": [ | ||||||
| "pipedream", | ||||||
| "goodbits" | ||||||
| ], | ||||||
| "files": ["dist"], | ||||||
| "homepage": "https://pipedream.com/apps/goodbits", | ||||||
| "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.
Uh oh!
There was an error while loading. Please reload this page.