Skip to content
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
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import reddit from "../../reddit.app.mjs";
import { axios } from "@pipedream/platform";
import reddit from "../../reddit.app.mjs";

export default {
type: "action",
key: "reddit-list-comments-in-a-post",
version: "0.1.1",
version: "0.1.2",
name: "List Comments in a Post",
description: "List comments for a specific post. [See the docs here](https://www.reddit.com/dev/api/#GET_comments_{article})",
props: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import reddit from "../../reddit.app.mjs";
import { axios } from "@pipedream/platform";
import reddit from "../../reddit.app.mjs";

export default {
type: "action",
key: "reddit-list-subreddits-by-query",
version: "0.1.1",
version: "0.1.2",
name: "List Subreddits by Query",
description: "List subreddits based on a search criteria. [See the docs here](https://www.reddit.com/dev/api/#GET_subreddits_search)",
props: {
Expand Down
2 changes: 1 addition & 1 deletion components/reddit/actions/search-post/search-post.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import reddit from "../../reddit.app.mjs";
export default {
type: "action",
key: "reddit-search-post",
version: "0.1.1",
version: "0.1.2",
name: "Search Post",
description: "Search posts by title. [See the docs here](https://www.reddit.com/dev/api/#GET_search)",
props: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import reddit from "../../reddit.app.mjs";
export default {
type: "action",
key: "reddit-submit-a-comment",
version: "0.1.1",
version: "0.1.2",
name: "Submit a Comment",
description: "Submit a new comment or reply to a message. [See the docs here](https://www.reddit.com/dev/api/#POST_api_comment)",
props: {
Expand Down
4 changes: 2 additions & 2 deletions components/reddit/actions/submit-a-post/submit-a-post.mjs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { axios } from "@pipedream/platform";
import reddit from "../../reddit.app.mjs";
import tzs from "../../pytz-timezones.mjs";
import reddit from "../../reddit.app.mjs";

export default {
type: "action",
key: "reddit-submit-a-post",
version: "0.1.1",
version: "0.1.2",
name: "Submit a Post",
description: "Create a post to a subreddit. [See the docs here](https://www.reddit.com/dev/api/#POST_api_submit)",
props: {
Expand Down
4 changes: 2 additions & 2 deletions components/reddit/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pipedream/reddit",
"version": "1.1.3",
"version": "1.2.0",
"description": "Pipedream Reddit Components",
"main": "reddit.app.mjs",
"keywords": [
Expand All @@ -13,7 +13,7 @@
"access": "public"
},
"dependencies": {
"@pipedream/platform": "^1.4.0",
"@pipedream/platform": "^3.1.0",
"async-retry": "^1.3.3",
"axios": "^0.27.2",
"lodash": "^4.17.21",
Expand Down
11 changes: 9 additions & 2 deletions components/reddit/reddit.app.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { axios } from "@pipedream/platform";
import qs from "qs";
import isNil from "lodash/isNil.js";
import retry from "async-retry";
import get from "lodash/get.js";
import isNil from "lodash/isNil.js";
import qs from "qs";

export default {
type: "app",
Expand Down Expand Up @@ -490,5 +490,12 @@ export default {
},
}));
},
getPrivateMessages(opts = { }) {
return this._withRetries(() =>
this._makeRequest({
path: "/message/inbox",
...opts,
}));
},
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
key: "reddit-new-comments-by-user",
name: "New Comments by User",
description: "Emit new event each time a user posts a new comment.",
version: "0.1.1",
version: "0.1.2",
dedupe: "unique",
props: {
...common.props,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import common from "../common.mjs";
import get from "lodash/get.js";
import common from "../common.mjs";
const { reddit } = common.props;

export default {
Expand All @@ -9,7 +9,7 @@ export default {
name: "New comments on a post",
description:
"Emit new event each time a new comment is added to a subreddit.",
version: "0.1.1",
version: "0.1.2",
dedupe: "unique",
props: {
...common.props,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import get from "lodash/get.js";
import common from "../common.mjs";
import sampleEmit from "./test-event.mjs";
import regionData from "./region-data.mjs";
import get from "lodash/get.js";
import sampleEmit from "./test-event.mjs";
const { reddit } = common.props;

export default {
Expand All @@ -11,7 +11,7 @@ export default {
name: "New hot posts on a subreddit",
description:
"Emit new event each time a new hot post is added to the top 10 items in a subreddit.",
version: "0.2.2",
version: "0.2.3",
dedupe: "unique",
props: {
...common.props,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
key: "reddit-new-links-by-user",
name: "New Links by User",
description: "Emit new event each time a user posts a new link.",
version: "0.1.1",
version: "0.1.2",
dedupe: "unique",
props: {
...common.props,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import common from "../common.mjs";
import get from "lodash/get.js";
import common from "../common.mjs";
const { reddit } = common.props;

export default {
Expand All @@ -8,7 +8,7 @@ export default {
key: "reddit-new-links-on-a-subreddit",
name: "New Links on a Subreddit",
description: "Emit new event each time a new link is added to a subreddit",
version: "0.1.1",
version: "0.1.2",
dedupe: "unique",
props: {
...common.props,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import common from "../common.mjs";

export default {
...common,
type: "source",
key: "reddit-new-private-message",
name: "New Private Message",
description: "Emit new event each time you receive a new private message.",
version: "0.0.1",
dedupe: "unique",
hooks: {
async deploy() {
// Emits sample events on the first run during deploy.
var privateMessages = await this.reddit.getPrivateMessages({
params: {
limit: 20,
},
});

let { children: messages = [] } = privateMessages.data;
if (messages.length === 0) {
console.log("No data available, skipping iteration");
return;
}

const { id = this._getBefore() } = messages[0].data;
this._setBefore(id);
messages.reverse().forEach(this.emitRedditEvent);
},
},
methods: {
...common.methods,
generateEventMetadata(redditEvent) {
return {
id: redditEvent.data.id,
summary: redditEvent.data.body,
ts: redditEvent.data.created,
};
},
},
async run() {
let privateMessages;
do {
privateMessages = await this.reddit.getPrivateMessages({
params: {
before: `t4_${this._getBefore()}`,
limit: 2,
},
});

const { children: messages = [] } = privateMessages.data;
if (messages.length === 0) {
console.log("No data available, skipping iteration");
break;
}
const { id } = messages[0].data;
this._setBefore(id);

messages.reverse().forEach((message) => {
this.emitRedditEvent(message);
});
} while (privateMessages);
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
key: "reddit-new-saved-post-by-user",
name: "New Saved Post by User",
description: "Emit new event each time a user saves a post.",
version: "0.1.2",
version: "0.1.3",
dedupe: "unique",
props: {
...common.props,
Expand Down
10 changes: 4 additions & 6 deletions pnpm-lock.yaml

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

Loading