-
Notifications
You must be signed in to change notification settings - Fork 5.5k
17129 app issuebadge #17297
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
17129 app issuebadge #17297
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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
62 changes: 62 additions & 0 deletions
62
components/issue_badge/actions/create-badge/create-badge.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,62 @@ | ||
| import { getFileStreamAndMetadata } from "@pipedream/platform"; | ||
| import FormData from "form-data"; | ||
| import issueBadge from "../../issue_badge.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "issue_badge-create-badge", | ||
| name: "Create Badge", | ||
| description: "Create a new badge [See the documentation](https://documenter.getpostman.com/view/19911979/2sA2r9X4Aj#2d909087-86e3-4e78-82ce-7b1691285a20)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| issueBadge, | ||
| name: { | ||
| type: "string", | ||
| label: "Badge Name", | ||
| description: "The name of the badge", | ||
| optional: true, | ||
| }, | ||
| description: { | ||
| type: "string", | ||
| label: "Description", | ||
| description: "Description of the badge", | ||
| }, | ||
| badgeLogo: { | ||
| type: "string", | ||
| label: "Badge Logo", | ||
| description: "Provide either a file URL or a path to a file in the `/tmp` directory (for example, `/tmp/myFile.png`)", | ||
| }, | ||
| comment: { | ||
| type: "string", | ||
| label: "Comment", | ||
| description: "Comment for the badge", | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const formData = new FormData(); | ||
| if (this.name) formData.append("name", this.name); | ||
| if (this.description) formData.append("description", this.description); | ||
| if (this.comment) formData.append("comment", this.comment); | ||
|
|
||
| if (this.badgeLogo) { | ||
| const { | ||
| stream, metadata, | ||
| } = await getFileStreamAndMetadata(this.badgeLogo); | ||
| formData.append("badge_logo", stream, { | ||
| contentType: metadata.contentType, | ||
| knownLength: metadata.size, | ||
| filename: metadata.name, | ||
| }); | ||
| } | ||
|
|
||
| const result = await this.issueBadge.createBadge({ | ||
| $, | ||
| data: formData, | ||
| headers: formData.getHeaders(), | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully created badge with ID: ${result.badgeId}`); | ||
| return result; | ||
luancazarine marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }, | ||
| }; | ||
49 changes: 49 additions & 0 deletions
49
components/issue_badge/actions/create-issue/create-issue.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,49 @@ | ||
| import issueBadge from "../../issue_badge.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "issue_badge-create-issue", | ||
| name: "Create Issue", | ||
| description: "Create a new issue [See the documentation](https://documenter.getpostman.com/view/19911979/2sA2r9X4Aj#b5b9801a-432d-4d2e-96ef-a9fb2d2d2a94)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| issueBadge, | ||
| name: { | ||
| type: "string", | ||
| label: "Name", | ||
| description: "The name of the issue", | ||
| }, | ||
luancazarine marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| badgeId: { | ||
| propDefinition: [ | ||
| issueBadge, | ||
| "badgeId", | ||
| ], | ||
| }, | ||
| email: { | ||
| type: "string", | ||
| label: "Email", | ||
| description: "The email of the recipient", | ||
| optional: true, | ||
| }, | ||
| phone: { | ||
| type: "string", | ||
| label: "Phone", | ||
| description: "The phone number of the recipient", | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const result = await this.issueBadge.createIssue({ | ||
| $, | ||
| data: { | ||
| name: this.name, | ||
| badge_id: this.badgeId, | ||
| email: this.email, | ||
| phone: this.phone, | ||
| }, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully created issue with ID: ${result.IssueId}`); | ||
| return result; | ||
| }, | ||
| }; | ||
62 changes: 62 additions & 0 deletions
62
components/issue_badge/actions/create-organization/create-organization.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,62 @@ | ||
| import { getFileStreamAndMetadata } from "@pipedream/platform"; | ||
| import FormData from "form-data"; | ||
| import issueBadge from "../../issue_badge.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "issue_badge-create-organization", | ||
| name: "Create Organization", | ||
| description: "Create a new organization [See the documentation](https://documenter.getpostman.com/view/19911979/2sA2r9X4Aj#9f046aa2-e975-420f-a9ec-3274ea74c6bd)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| issueBadge, | ||
| name: { | ||
| type: "string", | ||
| label: "Organization Name", | ||
| description: "The name of the organization", | ||
| }, | ||
| description: { | ||
| type: "string", | ||
| label: "Description", | ||
| description: "Description of the organization", | ||
| }, | ||
| badgeLogo: { | ||
| type: "string", | ||
| label: "Badge Logo", | ||
| description: "Provide either a file URL or a path to a file in the `/tmp` directory (for example, `/tmp/myFile.png`)", | ||
| optional: true, | ||
| }, | ||
| comment: { | ||
| type: "string", | ||
| label: "Comment", | ||
| description: "Comment for the organization", | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const formData = new FormData(); | ||
| formData.append("name", this.name); | ||
| formData.append("description", this.description); | ||
| if (this.comment) formData.append("comment", this.comment); | ||
|
|
||
| if (this.badgeLogo) { | ||
| const { | ||
| stream, metadata, | ||
| } = await getFileStreamAndMetadata(this.badgeLogo); | ||
| formData.append("badge_logo", stream, { | ||
| contentType: metadata.contentType, | ||
| knownLength: metadata.size, | ||
| filename: metadata.name, | ||
| }); | ||
| } | ||
|
|
||
| const response = await this.issueBadge.createOrganization({ | ||
| $, | ||
| data: formData, | ||
| headers: formData.getHeaders(), | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully created organization with ID: ${response.data.uu_id.id}`); | ||
| return response; | ||
| }, | ||
| }; |
20 changes: 20 additions & 0 deletions
20
components/issue_badge/actions/get-all-badges/get-all-badges.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,20 @@ | ||
| import issueBadge from "../../issue_badge.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "issue_badge-get-all-badges", | ||
| name: "Get All Badges", | ||
| description: "Retrieve all badges [See the documentation](https://documenter.getpostman.com/view/19911979/2sA2r9X4Aj#5d30c8a9-f16a-4dfb-a3e0-c241e60935c4)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| issueBadge, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.issueBadge.listAllBadges({ | ||
| $, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully retrieved ${response.data.length} badges`); | ||
| return response.data; | ||
| }, | ||
| }; |
20 changes: 20 additions & 0 deletions
20
components/issue_badge/actions/get-all-organizations/get-all-organizations.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,20 @@ | ||
| import issueBadge from "../../issue_badge.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "issue_badge-get-all-organizations", | ||
| name: "Get All Organizations", | ||
| description: "Retrieve all organizations [See the documentation](https://documenter.getpostman.com/view/19911979/2sA2r9X4Aj#64e5ee48-8e20-463b-addd-e697452e8e5a)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| issueBadge, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.issueBadge.listAllOrganizations({ | ||
| $, | ||
| }); | ||
|
|
||
| $.export("$summary", `Successfully retrieved ${response.data.length} organizations`); | ||
| return response.data; | ||
| }, | ||
| }; |
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 |
|---|---|---|
| @@ -1,11 +1,78 @@ | ||
| import { axios } from "@pipedream/platform"; | ||
|
|
||
| export default { | ||
| type: "app", | ||
| app: "issue_badge", | ||
| propDefinitions: {}, | ||
| propDefinitions: { | ||
| badgeId: { | ||
| type: "string", | ||
| label: "Badge ID", | ||
| description: "The ID of the badge to create an issue for", | ||
| async options() { | ||
| const { data } = await this.listAllBadges(); | ||
|
|
||
| return data.map(({ | ||
| id: value, name: label, | ||
| }) => ({ | ||
| label, | ||
| value, | ||
| })); | ||
| }, | ||
| }, | ||
| }, | ||
| methods: { | ||
| // this.$auth contains connected account data | ||
| authKeys() { | ||
| console.log(Object.keys(this.$auth)); | ||
| _baseUrl() { | ||
| return "https://app.issuebadge.com/api/v1"; | ||
| }, | ||
| _headers(headers = {}) { | ||
| return { | ||
| Authorization: `Bearer ${this.$auth.api_key}`, | ||
| accept: "application/json", | ||
| ...headers, | ||
| }; | ||
| }, | ||
| _makeRequest({ | ||
| $ = this, path, headers, ...opts | ||
| }) { | ||
| return axios($, { | ||
| url: this._baseUrl() + path, | ||
| headers: this._headers(headers), | ||
| ...opts, | ||
| }); | ||
| }, | ||
| createOrganization(opts = {}) { | ||
| return this._makeRequest({ | ||
| method: "POST", | ||
| path: "/organization/create", | ||
| ...opts, | ||
| }); | ||
| }, | ||
| listAllOrganizations(opts = {}) { | ||
| return this._makeRequest({ | ||
| method: "POST", | ||
| path: "/organization/getall", | ||
| ...opts, | ||
| }); | ||
| }, | ||
| listAllBadges(opts = {}) { | ||
| return this._makeRequest({ | ||
| path: "/badge/getall", | ||
| ...opts, | ||
| }); | ||
| }, | ||
| createBadge(opts = {}) { | ||
| return this._makeRequest({ | ||
| method: "POST", | ||
| path: "/badge/create", | ||
| ...opts, | ||
| }); | ||
| }, | ||
| createIssue(opts = {}) { | ||
| return this._makeRequest({ | ||
| method: "POST", | ||
| path: "/issue/create", | ||
| ...opts, | ||
| }); | ||
| }, | ||
| }, | ||
| }; |
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 |
|---|---|---|
| @@ -1,15 +1,21 @@ | ||
| { | ||
| "name": "@pipedream/issue_badge", | ||
| "version": "0.0.1", | ||
| "description": "Pipedream Issue Badge Components", | ||
| "version": "0.1.0", | ||
| "description": "Pipedream Issue Badge Components - Manage badges, issues, and organizations", | ||
| "main": "issue_badge.app.mjs", | ||
| "keywords": [ | ||
| "pipedream", | ||
| "issue_badge" | ||
| "issue_badge", | ||
| "badges", | ||
| "issues", | ||
| "organizations" | ||
| ], | ||
| "homepage": "https://pipedream.com/apps/issue_badge", | ||
| "author": "Pipedream <[email protected]> (https://pipedream.com/)", | ||
| "publishConfig": { | ||
| "access": "public" | ||
| }, | ||
| "dependencies": { | ||
| "@pipedream/platform": "^3.1.0" | ||
| } | ||
| } | ||
| } |
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.