- 
                Notifications
    
You must be signed in to change notification settings  - Fork 5.5k
 
New Components - streamlabs #15557
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 - streamlabs #15557
Changes from all commits
      Commits
    
    
  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
        
          
          
            74 changes: 74 additions & 0 deletions
          
          74 
        
  components/streamlabs/actions/create-donation/create-donation.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,74 @@ | ||
| import streamlabs from "../../streamlabs.app.mjs"; | ||
| import currencies from "../../common/currencies.mjs"; | ||
| 
     | 
||
| export default { | ||
| key: "streamlabs-create-donation", | ||
| name: "Create Donation", | ||
| description: "Create a donation for the authenticated user. [See the documentation](https://dev.streamlabs.com/reference/donations-1)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| streamlabs, | ||
| name: { | ||
| type: "string", | ||
| label: "Name", | ||
| description: "The name of the donor. Has to be between 2-25 length and should only contain utf8 characters", | ||
| }, | ||
| identifier: { | ||
| type: "string", | ||
| label: "Identifier", | ||
| description: "An identifier for this donor, which is used to group donations with the same donor. For example, if you create more than one donation with the same identifier, they will be grouped together as if they came from the same donor. Typically this is best suited as an email address, or a unique hash.", | ||
| }, | ||
| amount: { | ||
| type: "string", | ||
| label: "Amount", | ||
| description: "The amount of this donation", | ||
| }, | ||
| currency: { | ||
| type: "string", | ||
| label: "Currency", | ||
| description: "The 3 letter currency code for this donation. Must be one of the [supported currency codes](https://dev.streamlabs.com/docs/currency-codes)", | ||
| options: currencies, | ||
| }, | ||
| message: { | ||
| type: "string", | ||
| label: "Message", | ||
| description: "The message from the donor. Must be < 255 characters", | ||
| optional: true, | ||
| }, | ||
| createdAt: { | ||
| type: "string", | ||
| label: "Created At", | ||
| description: "A timestamp that identifies when this donation was made. If left blank, it will default to now. Enter in ISO-8601 format (e.g., `2018-02-18T02:30:00-07:00` or `2018-02-18T08:00:00Z`, where Z stands for UTC)", | ||
| optional: true, | ||
| }, | ||
| skipAlert: { | ||
| type: "string", | ||
| label: "Skip Alert", | ||
| description: "Set to `yes` if you need to skip the alert. Default is `no`", | ||
| options: [ | ||
| "yes", | ||
| "no", | ||
| ], | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.streamlabs.createDonation({ | ||
| $, | ||
| data: { | ||
| name: this.name, | ||
| identifier: this.identifier, | ||
| amount: parseFloat(this.amount), | ||
| currency: this.currency, | ||
| message: this.message, | ||
| createdAt: this.createdAt && Date.parse(this.createdAt), | ||
| skip_alert: this.skipAlert, | ||
| }, | ||
| }); | ||
| if (response?.donation_id) { | ||
| $.export("$summary", `Successfully created donation with ID: ${response.donation_id}`); | ||
| } | ||
| 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,74 @@ | ||
| import streamlabs from "../../streamlabs.app.mjs"; | ||
| 
     | 
||
| export default { | ||
| key: "streamlabs-send-alert", | ||
| name: "Send Alert", | ||
| description: "Sends an alert to the stream overlay with a custom message, image, and sound. [See the documentation](https://dev.streamlabs.com/reference/alerts)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| streamlabs, | ||
| type: { | ||
| type: "string", | ||
| label: "Type", | ||
| description: "determines which alert box this alert will show up in", | ||
| options: [ | ||
| "follow", | ||
| "subscription", | ||
| "donation", | ||
| "host", | ||
| ], | ||
| }, | ||
| message: { | ||
| type: "string", | ||
| label: "Message", | ||
| description: "The message to show with this alert", | ||
| }, | ||
| imageHref: { | ||
| type: "string", | ||
| label: "Image HREF", | ||
| description: "The href pointing to an image resource to play when this alert shows", | ||
| optional: true, | ||
| }, | ||
| soundHref: { | ||
| type: "string", | ||
| label: "Sound HREF", | ||
| description: "The href pointing to a sound resource to play when this alert shows", | ||
| optional: true, | ||
| }, | ||
| userMessage: { | ||
| type: "string", | ||
| label: "User Message", | ||
| description: "Acting as the second heading, this shows below message", | ||
| optional: true, | ||
| }, | ||
| duration: { | ||
| type: "string", | ||
| label: "Duration", | ||
| description: "How many seconds this alert should be displayed. Value should be in milliseconds. Ex: `1000` for 1 second.", | ||
| optional: true, | ||
| }, | ||
                
      
                  michelle0927 marked this conversation as resolved.
               
          
            Show resolved
            Hide resolved
         | 
||
| specialTextColor: { | ||
| type: "string", | ||
| label: "Special Text Color", | ||
| description: "The color to use for special tokens. Must be a valid CSS color string", | ||
| optional: true, | ||
| }, | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.streamlabs.sendAlert({ | ||
| $, | ||
| data: { | ||
| type: this.type, | ||
| message: this.message, | ||
| image_href: this.imageHref, | ||
| sound_href: this.soundHref, | ||
| user_message: this.userMessage, | ||
| duration: this.duration, | ||
| special_text_color: this.specialTextColor, | ||
| }, | ||
| }); | ||
| $.export("$summary", `Alert sent with message: ${this.message}`); | ||
| return response; | ||
| }, | ||
                
      
                  michelle0927 marked this conversation as resolved.
               
          
            Show resolved
            Hide resolved
         | 
||
| }; | ||
        
          
          
            64 changes: 64 additions & 0 deletions
          
          64 
        
  components/streamlabs/actions/send-test-alert/send-test-alert.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,64 @@ | ||
| import streamlabs from "../../streamlabs.app.mjs"; | ||
| 
     | 
||
| export default { | ||
| key: "streamlabs-send-test-alert", | ||
| name: "Send Test Alert", | ||
| description: "Send a test alert to the stream overlay in StreamLabs. [See the documentation](https://dev.streamlabs.com/reference/alertssend_test_alert)", | ||
| version: "0.0.1", | ||
| type: "action", | ||
| props: { | ||
| streamlabs, | ||
| platform: { | ||
| type: "string", | ||
| label: "Platform", | ||
| description: "The streaming platform", | ||
| options: [ | ||
| "twitch", | ||
| "youtube", | ||
| ], | ||
| reloadProps: true, | ||
| }, | ||
| }, | ||
| additionalProps() { | ||
| if (!this.platform) { | ||
| return {}; | ||
| } | ||
| const props = { | ||
| type: { | ||
| type: "string", | ||
| label: "Type", | ||
| description: "The type of the alert", | ||
| }, | ||
| }; | ||
| if (this.platform === "twitch") { | ||
| props.type.options = [ | ||
| "follow", | ||
| "subscription", | ||
| "donation", | ||
| "host", | ||
| "bits", | ||
| "raid", | ||
| ]; | ||
| } | ||
| if (this.platform === "youtube") { | ||
| props.type.options = [ | ||
| "subscription", | ||
| "sponsor", | ||
| "superchat", | ||
| "donation", | ||
| ]; | ||
| } | ||
| return props; | ||
| }, | ||
| async run({ $ }) { | ||
| const response = await this.streamlabs.sendTestAlert({ | ||
| $, | ||
| data: { | ||
| platform: this.platform, | ||
| type: this.type, | ||
| }, | ||
| }); | ||
| $.export("$summary", "Successfully sent test alert"); | ||
| 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,90 @@ | ||
| export default [ | ||
| { | ||
| value: "USD", | ||
| label: "US Dollar", | ||
| }, | ||
| { | ||
| value: "AUD", | ||
| label: "Australian Dollar", | ||
| }, | ||
| { | ||
| value: "BRL", | ||
| label: "Brazilian Real", | ||
| }, | ||
| { | ||
| value: "CAD", | ||
| label: "Canadian Dollar", | ||
| }, | ||
| { | ||
| value: "CZK", | ||
| label: "Czech Koruna", | ||
| }, | ||
| { | ||
| value: "DKK", | ||
| label: "Danish Krone", | ||
| }, | ||
| { | ||
| value: "EUR", | ||
| label: "Euro", | ||
| }, | ||
| { | ||
| value: "HKD", | ||
| label: "Hong Kong Dollar", | ||
| }, | ||
| { | ||
| value: "ILS", | ||
| label: "Israeli New Sheqel", | ||
| }, | ||
| { | ||
| value: "MYR", | ||
| label: "Malaysian Ringgit", | ||
| }, | ||
| { | ||
| value: "MXN", | ||
| label: "Mexican Peso", | ||
| }, | ||
| { | ||
| value: "NOK", | ||
| label: "Norwegian Krone", | ||
| }, | ||
| { | ||
| value: "NZD", | ||
| label: "New Zealand Dollar", | ||
| }, | ||
| { | ||
| value: "PHP", | ||
| label: "Philippine Peso", | ||
| }, | ||
| { | ||
| value: "PLN", | ||
| label: "Polish Zloty", | ||
| }, | ||
| { | ||
| value: "GBP", | ||
| label: "Pound Sterling", | ||
| }, | ||
| { | ||
| value: "RUB", | ||
| label: "Russian Ruble", | ||
| }, | ||
| { | ||
| value: "SGD", | ||
| label: "Singapore Dollar", | ||
| }, | ||
| { | ||
| value: "SEK", | ||
| label: "Swedish Krona", | ||
| }, | ||
| { | ||
| value: "CHF", | ||
| label: "Swiss Franc", | ||
| }, | ||
| { | ||
| value: "THB", | ||
| label: "Thai Baht", | ||
| }, | ||
| { | ||
| value: "TRY", | ||
| label: "Turkish Lira", | ||
| }, | ||
| ]; | 
  
    
      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,18 @@ | ||
| { | ||
| "name": "@pipedream/streamlabs", | ||
| "version": "0.0.1", | ||
| "description": "Pipedream Streamlabs Components", | ||
| "main": "streamlabs.app.mjs", | ||
| "keywords": [ | ||
| "pipedream", | ||
| "streamlabs" | ||
| ], | ||
| "homepage": "https://pipedream.com/apps/streamlabs", | ||
| "author": "Pipedream <support@pipedream.com> (https://pipedream.com/)", | ||
| "publishConfig": { | ||
| "access": "public" | ||
| }, | ||
| "dependencies": { | ||
| "@pipedream/platform": "^3.0.3" | ||
| } | ||
| } | 
  
    
      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,51 @@ | ||
| import { axios } from "@pipedream/platform"; | ||
| 
     | 
||
| export default { | ||
| type: "app", | ||
| app: "streamlabs", | ||
| propDefinitions: {}, | ||
| methods: { | ||
| // this.$auth contains connected account data | ||
| authKeys() { | ||
| console.log(Object.keys(this.$auth)); | ||
| _baseUrl() { | ||
| return "https://streamlabs.com/api/v1.0"; | ||
| }, | ||
| _accessToken() { | ||
| return this.$auth.oauth_access_token; | ||
| }, | ||
| _makeRequest({ | ||
| $ = this, | ||
| path, | ||
| data, | ||
| ...otherOpts | ||
| }) { | ||
| return axios($, { | ||
| ...otherOpts, | ||
| url: `${this._baseUrl()}${path}`, | ||
| data: { | ||
| access_token: this._accessToken(), | ||
| ...data, | ||
| }, | ||
| }); | ||
| }, | ||
| sendAlert(opts = {}) { | ||
| return this._makeRequest({ | ||
| method: "POST", | ||
| path: "/alerts", | ||
| ...opts, | ||
| }); | ||
| }, | ||
| createDonation(opts = {}) { | ||
| return this._makeRequest({ | ||
| method: "POST", | ||
| path: "/donations", | ||
| ...opts, | ||
| }); | ||
| }, | ||
| sendTestAlert(opts = {}) { | ||
| return this._makeRequest({ | ||
| method: "POST", | ||
| path: "/alerts/send_test_alert", | ||
| ...opts, | ||
| }); | ||
| }, | ||
                
      
                  michelle0927 marked this conversation as resolved.
               
          
            Show resolved
            Hide resolved
         | 
||
| }, | ||
| }; | ||
      
      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.