Skip to content

[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

Merged
merged 3 commits into from
Apr 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
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,44 @@
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: {
subscriber: {
email: this.email,
first_name: this.firstName,
last_name: this.lastName,
},
},
});
$.export("$summary", "Successfully created new subscriber");
return response;
},
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
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.updateSubscriberStatus({
$,
email: this.email,
data: {
subscriber: {
status: this.status,
},
},
});
$.export("$summary", "Successfully uptated subscriber status");
return response;
},
};
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 updateSubscriberStatus({
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 <support@pipedream.com> (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