Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions components/goodbits/.gitignore

This file was deleted.

56 changes: 56 additions & 0 deletions components/goodbits/actions/create-link/create-link.mjs
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;
},
Copy link
Contributor

@coderabbitai coderabbitai bot Apr 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Verification agent

🧩 Analysis chain

Fix 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.mjs

Length of output: 357


Fix typo in success message and improve method naming

  • In components/goodbits/actions/update-subscriber-status/update-subscriber-status.mjs:
    • Correct the typo in the summary export.
  • In components/goodbits/goodbits.app.mjs:
    • The unsubscribeSubscriber method actually issues a PUT to update subscriber data. Consider renaming it (e.g. to updateSubscriberStatus or updateSubscriber) to better reflect its behavior—and update all callers accordingly.
 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

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
async run({ $ }) {
const response = await this.app.unsubscribeSubscriber({
$,
email: this.email,
data: {
status: this.status,
},
});
$.export("$summary", "Successfully uptated subscriber status");
return response;
},
async run({ $ }) {
const response = await this.app.unsubscribeSubscriber({
$,
email: this.email,
data: {
status: this.status,
},
});
$.export("$summary", "Successfully updated subscriber status");
return response;
},

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo!

Copy link
Contributor

Choose a reason for hiding this comment

The 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?

};
13 changes: 0 additions & 13 deletions components/goodbits/app/goodbits.app.ts

This file was deleted.

8 changes: 8 additions & 0 deletions components/goodbits/common/constants.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export default {
STATUS_OPTIONS: [
"unsubscribed",
"cleaned",
"pending",
"deleted",
],
};
105 changes: 105 additions & 0 deletions components/goodbits/goodbits.app.mjs
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,
},
});
},
async createSubscriber(args = {}) {
return this._makeRequest({
path: "/subscribers",
method: "post",
...args,
});
},
async unsubscribeSubscriber({
email, ...args
}) {
return this._makeRequest({
path: `/subscribers/${email}`,
method: "put",
...args,
});
},
async createLink(args = {}) {
return this._makeRequest({
path: "/links",
method: "post",
...args,
});
},
},
};
8 changes: 5 additions & 3 deletions components/goodbits/package.json
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",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"version": "0.0.1",
"version": "0.1.0",

"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"
}
}
6 changes: 5 additions & 1 deletion pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading