-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New Components - beekeeper #16925
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
New Components - beekeeper #16925
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
bddac8c
beekeeper init
luancazarine c197328
[Components] beekeeper #13273
luancazarine f4b058b
pnpm update
luancazarine 361f718
delete node_modules
luancazarine 5f19705
some adjusts
luancazarine d0be72d
Update components/beekeeper/package.json
michelle0927 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
101 changes: 101 additions & 0 deletions
101
components/beekeeper/actions/create-post/create-post.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,101 @@ | ||
| import beekeeper from "../../beekeeper.app.mjs"; | ||
| import { parseObject } from "../../common/utils.mjs"; | ||
|
|
||
| export default { | ||
| key: "beekeeper-create-post", | ||
| name: "Create Post", | ||
| description: "Create a new text or multimedia post in a defined stream. [See the documentation](https://beekeeper.stoplight.io/docs/beekeeper-api/18408b41927b9-creates-a-new-post)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| beekeeper, | ||
| streamId: { | ||
| propDefinition: [ | ||
| beekeeper, | ||
| "streamId", | ||
| ], | ||
| }, | ||
| text: { | ||
| type: "string", | ||
| label: "Text", | ||
| description: "The text content of the post", | ||
| }, | ||
| files: { | ||
| type: "string[]", | ||
| label: "Files", | ||
| description: "List of file objects to be attached. E.g. [{\"name\": \"fair_play_rules.pdf\", \"url\": \"https://mytenant.beekeeper.io/file/665987/original/fair_play_rules.pdf\", \"userid\": \"5cb9v45d-8i78-4v65-b5fd-81cgfac3ef17\", \"height\": 619, \"width\": 700, \"key\": \"f4fdaab0-d198-49b4-b1cc-dd85572d72f1\", \"media_type\": \"image/png\", \"usage_type\": \"attachment_image\" }]. [See the documentation](https://beekeeper.stoplight.io/docs/beekeeper-api/18408b41927b9-creates-a-new-post) for further details.", | ||
| optional: true, | ||
| }, | ||
| locked: { | ||
| type: "boolean", | ||
| label: "Locked", | ||
| description: "Disables adding comments on the post", | ||
| optional: true, | ||
| }, | ||
| title: { | ||
| type: "string", | ||
| label: "Title", | ||
| description: "The title of the post", | ||
| optional: true, | ||
| }, | ||
| media: { | ||
| type: "string[]", | ||
| label: "Media", | ||
| description: "List of Photo or Video objects. E.g. [{\"name\": \"fair_play_rules.pdf\", \"url\": \"https://mytenant.beekeeper.io/file/665987/original/fair_play_rules.pdf\", \"userid\": \"5cb9v45d-8i78-4v65-b5fd-81cgfac3ef17\", \"height\": 619, \"width\": 700, \"key\": \"f4fdaab0-d198-49b4-b1cc-dd85572d72f1\", \"media_type\": \"image/png\", \"usage_type\": \"attachment_image\" }]. [See the documentation](https://beekeeper.stoplight.io/docs/beekeeper-api/18408b41927b9-creates-a-new-post) for further details.", | ||
| optional: true, | ||
| }, | ||
| labels: { | ||
| type: "string[]", | ||
| label: "Labels", | ||
| description: "List of labels attached to the post", | ||
| optional: true, | ||
| }, | ||
| sticky: { | ||
| type: "boolean", | ||
| label: "Sticky", | ||
| description: "Flag that pins a post to the top of the stream", | ||
| optional: true, | ||
| }, | ||
| reactionsDisabled: { | ||
| type: "boolean", | ||
| label: "Reactions Disabled", | ||
| description: "Flag that disables the ability to add reaction to the post and to see reactions that have been added", | ||
| optional: true, | ||
| }, | ||
| options: { | ||
| type: "object", | ||
| label: "Options", | ||
| description: "List of poll options in a post. E.g. [\"This Friday\", \"Monday next week\"]", | ||
| optional: true, | ||
| }, | ||
| scheduledAt: { | ||
| type: "string", | ||
| label: "Scheduled At", | ||
| description: "Date and time when the post is scheduled to be published (UTC timezone, yyyy-mm-ddTHH:MM:SS format)", | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.beekeeper.createPost({ | ||
| $, | ||
| data: { | ||
| streamid: this.streamId, | ||
| files: parseObject(this.files), | ||
| locked: this.locked, | ||
| title: this.title, | ||
| media: parseObject(this.media), | ||
| labels: parseObject(this.labels), | ||
| sticky: this.sticky, | ||
| reactions_disabled: this.reactionsDisabled, | ||
| text: this.text, | ||
| options: parseObject(this.options)?.map((item) => ({ | ||
| text: item, | ||
| })), | ||
| scheduled_at: this.scheduledAt, | ||
| }, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully created post with UUID: ${response.uuid}`); | ||
| return response; | ||
| }, | ||
| }; | ||
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,43 @@ | ||
| import beekeeper from "../../beekeeper.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "beekeeper-get-profile", | ||
| name: "Get User Profile", | ||
| description: "Retrieve the profile details of a specific user. [See the documentation](https://beekeeper.stoplight.io/docs/beekeeper-api/05bcd13b38a67-get-profile-of-the-given-user)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| beekeeper, | ||
| userId: { | ||
| propDefinition: [ | ||
| beekeeper, | ||
| "userId", | ||
| ], | ||
| }, | ||
| includeActivities: { | ||
| type: "boolean", | ||
| label: "Include Activities", | ||
| description: "Whether to include the user's activities.", | ||
| default: true, | ||
| }, | ||
| includeTotals: { | ||
| type: "boolean", | ||
| label: "Include Totals", | ||
| description: "Whether to include the user's total number of posts, comments, and likes received.", | ||
| default: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.beekeeper.getUserProfile({ | ||
| $, | ||
| userId: this.userId, | ||
| params: { | ||
| include_activities: this.includeActivities, | ||
| include_totals: this.includeTotals, | ||
| }, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully retrieved profile for user ID ${this.userId}`); | ||
| return response; | ||
| }, | ||
| }; |
86 changes: 86 additions & 0 deletions
86
components/beekeeper/actions/send-message-group-chat/send-message-group-chat.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,86 @@ | ||
| import { ConfigurationError } from "@pipedream/platform"; | ||
| import beekeeper from "../../beekeeper.app.mjs"; | ||
| import { parseObject } from "../../common/utils.mjs"; | ||
|
|
||
| export default { | ||
| key: "beekeeper-send-message-group-chat", | ||
| name: "Send Message to Group Chat", | ||
| description: "Send a precomposed message to a defined group chat. [See the documentation](https://beekeeper.stoplight.io/docs/beekeeper-api/9075b32d36db4-send-a-message-to-a-group-chat)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| beekeeper, | ||
| chatId: { | ||
| propDefinition: [ | ||
| beekeeper, | ||
| "chatId", | ||
| ], | ||
| }, | ||
| body: { | ||
| type: "string", | ||
| label: "Body", | ||
| description: "The message body. Supports rich text formatting.", | ||
| optional: true, | ||
| }, | ||
| attachment: { | ||
| type: "object", | ||
| label: "Attachment", | ||
| description: "JSON object representing attachment. A valid attachment object can be created and fetched using the POST /files/{usage_type}/upload endpoint.", | ||
| optional: true, | ||
| }, | ||
| eventType: { | ||
| type: "string", | ||
| label: "Event Type", | ||
| description: "Type of event that the message corresponds to.", | ||
| optional: true, | ||
| }, | ||
| chatStateAddons: { | ||
| type: "string[]", | ||
| label: "Chat State Addons", | ||
| description: "Array of objects containing type and data fields for chat state addons.", | ||
| optional: true, | ||
| }, | ||
| messageAddons: { | ||
| type: "string[]", | ||
| label: "Message Addons", | ||
| description: "Array of objects containing type and data fields for message addons.", | ||
| optional: true, | ||
| }, | ||
| mentions: { | ||
| propDefinition: [ | ||
| beekeeper, | ||
| "mentions", | ||
| ({ chatId }) => ({ | ||
| chatId, | ||
| }), | ||
| ], | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| if (!this.body && !this.event && !this.attachment && !this.chatStateAddons) { | ||
| throw new ConfigurationError("You must provide at least **Body**, **Event**, **Attachment** or **Chat State Addons**"); | ||
| } | ||
luancazarine marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| const response = await this.beekeeper.sendMessage({ | ||
| $, | ||
| chatId: this.chatId, | ||
| data: { | ||
| body: this.body, | ||
| attachment: parseObject(this.attachment), | ||
| ...this.eventType | ||
| ? { | ||
| event: { | ||
| type: this.eventType, | ||
| }, | ||
| } | ||
| : {}, | ||
luancazarine marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| chat_state_addons: parseObject(this.chatStateAddons), | ||
| message_addons: parseObject(this.messageAddons), | ||
| mentions: parseObject(this.mentions), | ||
| }, | ||
| }); | ||
|
|
||
| $.export("$summary", `Message sent successfully to chat ID: ${this.chatId}`); | ||
| return response; | ||
| }, | ||
| }; | ||
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.