-
Notifications
You must be signed in to change notification settings - Fork 5.5k
[Components] ayrshare #12524 #16744
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
[Components] ayrshare #12524 #16744
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
f0642cc
Added actions
lcaresia 749d99b
Added actions
lcaresia 2b13f6a
Merge branch 'master' into issue-12524
lcaresia 78a8442
Merge branch 'master' into issue-12524
lcaresia 1920120
Update update-user.mjs
lcaresia eab978c
Merge branch 'master' into issue-12524
lcaresia c7e7552
Merge branch 'master' into issue-12524
lcaresia 38c26bf
Merge branch 'master' into issue-12524
lcaresia 516019e
Merge branch 'master' into issue-12524
lcaresia 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
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,84 @@ | ||
| import app from "../../ayrshare.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "ayrshare-create-user", | ||
| name: "Create User", | ||
| description: "Create a new User Profile under your Primary Profile. [See the documentation](https://www.ayrshare.com/docs/apis/profiles/create-profile)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| title: { | ||
| propDefinition: [ | ||
| app, | ||
| "title", | ||
| ], | ||
| }, | ||
| messagingActive: { | ||
| propDefinition: [ | ||
| app, | ||
| "messagingActive", | ||
| ], | ||
| }, | ||
| hideTopHeader: { | ||
| propDefinition: [ | ||
| app, | ||
| "hideTopHeader", | ||
| ], | ||
| }, | ||
| topHeader: { | ||
| propDefinition: [ | ||
| app, | ||
| "topHeader", | ||
| ], | ||
| }, | ||
| subHeader: { | ||
| propDefinition: [ | ||
| app, | ||
| "subHeader", | ||
| ], | ||
| }, | ||
| disableSocial: { | ||
| propDefinition: [ | ||
| app, | ||
| "disableSocial", | ||
| ], | ||
| }, | ||
| team: { | ||
| propDefinition: [ | ||
| app, | ||
| "team", | ||
| ], | ||
| }, | ||
| email: { | ||
| propDefinition: [ | ||
| app, | ||
| "email", | ||
| ], | ||
| }, | ||
| tags: { | ||
| propDefinition: [ | ||
| app, | ||
| "tags", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.app.createUser({ | ||
| $, | ||
| data: { | ||
| title: this.title, | ||
| messagingActive: this.messagingActive, | ||
| hideTopHeader: this.hideTopHeader, | ||
| topHeader: this.topHeader, | ||
| subHeader: this.subHeader, | ||
| disableSocial: this.disableSocial, | ||
| team: this.team, | ||
| email: this.email, | ||
| tags: this.tags, | ||
| }, | ||
| }); | ||
| $.export("$summary", "Successfully created user with the profile Key: " + response.profileKey); | ||
| 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,37 @@ | ||
| import app from "../../ayrshare.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "ayrshare-delete-user", | ||
| name: "Delete User", | ||
| description: "Delete a user profile you are the owner of. [See the documentation](https://www.ayrshare.com/docs/apis/profiles/delete-profile)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| profileToDelete: { | ||
| propDefinition: [ | ||
| app, | ||
| "profileToDelete", | ||
| ], | ||
| }, | ||
| profileKey: { | ||
| propDefinition: [ | ||
| app, | ||
| "profileKey", | ||
| ], | ||
| description: "Unique key returned after profile creation. Must be informed only if `title` is not provided", | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.app.deleteUser({ | ||
| $, | ||
| data: { | ||
| title: this.profileToDelete, | ||
| profileKey: this.profileKey, | ||
| }, | ||
| }); | ||
| $.export("$summary", "Successfully sent the request to delete the user profile. Status: " + response.status); | ||
| 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,71 @@ | ||
| import app from "../../ayrshare.app.mjs"; | ||
|
|
||
| export default { | ||
| key: "ayrshare-update-user", | ||
| name: "Update User", | ||
| description: "Update an existing profile. [See the documentation](https://www.ayrshare.com/docs/apis/profiles/update-profile)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| app, | ||
| profileKey: { | ||
| propDefinition: [ | ||
| app, | ||
| "profileKey", | ||
| ], | ||
| }, | ||
| title: { | ||
| propDefinition: [ | ||
| app, | ||
| "title", | ||
| ], | ||
| description: "Unique title of the profile that will be updated", | ||
| }, | ||
| messagingActive: { | ||
| propDefinition: [ | ||
| app, | ||
| "messagingActive", | ||
| ], | ||
| }, | ||
| hideTopHeader: { | ||
| propDefinition: [ | ||
| app, | ||
| "hideTopHeader", | ||
| ], | ||
| }, | ||
| topHeader: { | ||
| propDefinition: [ | ||
| app, | ||
| "topHeader", | ||
| ], | ||
| }, | ||
| disableSocial: { | ||
| propDefinition: [ | ||
| app, | ||
| "disableSocial", | ||
| ], | ||
| }, | ||
| tags: { | ||
| propDefinition: [ | ||
| app, | ||
| "tags", | ||
| ], | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.app.updateUser({ | ||
| $, | ||
| data: { | ||
| title: this.title, | ||
| messagingActive: this.messagingActive, | ||
| hideTopHeader: this.hideTopHeader, | ||
| topHeader: this.topHeader, | ||
| disableSocial: this.disableSocial, | ||
| tags: this.tags, | ||
| profileKey: this.profileKey, | ||
| }, | ||
| }); | ||
| $.export("$summary", "Successfully sent the request to update the user profile. Status: " + response.status); | ||
| 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 |
|---|---|---|
| @@ -1,11 +1,130 @@ | ||
| import { axios } from "@pipedream/platform"; | ||
| import constants from "./common/constants.mjs"; | ||
|
|
||
| export default { | ||
| type: "app", | ||
| app: "ayrshare", | ||
| propDefinitions: {}, | ||
| propDefinitions: { | ||
| title: { | ||
| type: "string", | ||
| label: "Title", | ||
| description: "Unique title for the new profile", | ||
| }, | ||
| messagingActive: { | ||
| type: "boolean", | ||
| label: "Messaging Active", | ||
| description: "Enable messaging functionality for this profile", | ||
| optional: true, | ||
| }, | ||
| hideTopHeader: { | ||
| type: "boolean", | ||
| label: "Hide Top Header", | ||
| description: "Hide the top header text on the account linking page", | ||
| optional: true, | ||
| }, | ||
| topHeader: { | ||
| type: "string", | ||
| label: "Top Header", | ||
| description: "Custom header text shown on the social linking page", | ||
| optional: true, | ||
| }, | ||
| subHeader: { | ||
| type: "string", | ||
| label: "Sub Header", | ||
| description: "Custom sub-header text shown below the header on the linking page", | ||
| optional: true, | ||
| }, | ||
| disableSocial: { | ||
| type: "string[]", | ||
| label: "Disable Social", | ||
| description: "List of social platforms to disable for this profile", | ||
| options: constants.SOCIAL_NETWORKS, | ||
| optional: true, | ||
| }, | ||
| team: { | ||
| type: "boolean", | ||
| label: "Team", | ||
| description: "Set to true to invite the user as a team member", | ||
| optional: true, | ||
| }, | ||
| email: { | ||
| type: "string", | ||
| label: "Email", | ||
| description: "Email address to send the team invitation to", | ||
| optional: true, | ||
| }, | ||
| tags: { | ||
| type: "string[]", | ||
| label: "Tags", | ||
| description: "Custom internal tags to help categorize the profile", | ||
| optional: true, | ||
| }, | ||
| profileKey: { | ||
| type: "string", | ||
| label: "Profile Key", | ||
| description: "Unique key returned after profile creation", | ||
| }, | ||
| profileToDelete: { | ||
| type: "string", | ||
| label: "Title", | ||
| description: "Unique title of the profile that will be deleted. Must be informed only if `profileKey` is not provided", | ||
| optional: true, | ||
| async options() { | ||
| const response = await this.getProfiles(); | ||
| const profiles = response.profiles; | ||
| return profiles.map((profiles) => ({ | ||
| label: profiles.title, | ||
| value: profiles.title, | ||
| })); | ||
| }, | ||
| }, | ||
| }, | ||
| methods: { | ||
| // this.$auth contains connected account data | ||
| authKeys() { | ||
| console.log(Object.keys(this.$auth)); | ||
| _baseUrl() { | ||
| return "https://api.ayrshare.com/api"; | ||
| }, | ||
| async _makeRequest(opts = {}) { | ||
| const { | ||
| $ = this, | ||
| path, | ||
| headers, | ||
| ...otherOpts | ||
| } = opts; | ||
| return axios($, { | ||
| ...otherOpts, | ||
| url: this._baseUrl() + path, | ||
| headers: { | ||
| Authorization: `Bearer ${this.$auth.api_key}`, | ||
| ...headers, | ||
| }, | ||
| }); | ||
| }, | ||
| async createUser(args = {}) { | ||
| return this._makeRequest({ | ||
| path: "/profiles", | ||
| method: "post", | ||
| ...args, | ||
| }); | ||
| }, | ||
| async updateUser(args = {}) { | ||
| return this._makeRequest({ | ||
| path: "/profiles", | ||
| method: "patch", | ||
| ...args, | ||
| }); | ||
| }, | ||
| async deleteUser(args = {}) { | ||
| return this._makeRequest({ | ||
| path: "/profiles", | ||
| method: "delete", | ||
| ...args, | ||
| }); | ||
| }, | ||
| async getProfiles(args = {}) { | ||
| return this._makeRequest({ | ||
| path: "/profiles", | ||
| ...args, | ||
| }); | ||
| }, | ||
| }, | ||
| }; | ||
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,17 @@ | ||
| export default { | ||
| SOCIAL_NETWORKS: [ | ||
| "bluesky", | ||
| "facebook", | ||
| "gmb", | ||
| "instagram", | ||
| "linkedin", | ||
| "pinterest", | ||
| "reddit", | ||
| "snapchat", | ||
| "telegram", | ||
| "threads", | ||
| "tiktok", | ||
| "twitter", | ||
| "youtube", | ||
| ], | ||
| }; |
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,6 +1,6 @@ | ||
| { | ||
| "name": "@pipedream/ayrshare", | ||
| "version": "0.0.1", | ||
| "version": "0.1.0", | ||
| "description": "Pipedream Ayrshare Components", | ||
| "main": "ayrshare.app.mjs", | ||
| "keywords": [ | ||
|
|
@@ -11,5 +11,8 @@ | |
| "author": "Pipedream <[email protected]> (https://pipedream.com/)", | ||
| "publishConfig": { | ||
| "access": "public" | ||
| }, | ||
| "dependencies": { | ||
| "@pipedream/platform": "^3.0.3" | ||
| } | ||
| } | ||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.