Skip to content

Commit c8a8c53

Browse files
committed
new components
1 parent 0e7cdc4 commit c8a8c53

File tree

11 files changed

+327
-542
lines changed

11 files changed

+327
-542
lines changed
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
import streamlabs from "../../streamlabs.app.mjs";
2+
import currencies from "../../common/currencies.mjs";
3+
4+
export default {
5+
key: "streamlabs-create-donation",
6+
name: "Create Donation",
7+
description: "Create a donation for the authenticated user. [See the documentation](https://dev.streamlabs.com/reference/donations-1)",
8+
version: "0.0.1",
9+
type: "action",
10+
props: {
11+
streamlabs,
12+
name: {
13+
type: "string",
14+
label: "Name",
15+
description: "The name of the donor. Has to be between 2-25 length and should only contain utf8 characters",
16+
},
17+
identifier: {
18+
type: "string",
19+
label: "Identifier",
20+
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.",
21+
},
22+
amount: {
23+
type: "string",
24+
label: "Amount",
25+
description: "The amount of this donation",
26+
},
27+
currency: {
28+
type: "string",
29+
label: "Currency",
30+
description: "The 3 letter currency code for this donation. Must be one of the [supported currency codes](https://dev.streamlabs.com/docs/currency-codes)",
31+
options: currencies,
32+
},
33+
message: {
34+
type: "string",
35+
label: "Message",
36+
description: "The message from the donor. Must be < 255 characters",
37+
optional: true,
38+
},
39+
createdAt: {
40+
type: "string",
41+
label: "Created At",
42+
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)",
43+
optional: true,
44+
},
45+
skipAlert: {
46+
type: "string",
47+
label: "Skip Alert",
48+
description: "Set to `yes` if you need to skip the alert. Default is `no`",
49+
options: [
50+
"yes",
51+
"no",
52+
],
53+
optional: true,
54+
},
55+
},
56+
async run({ $ }) {
57+
const response = await this.streamlabs.createDonation({
58+
$,
59+
data: {
60+
name: this.name,
61+
identifier: this.identifier,
62+
amount: parseFloat(this.amount),
63+
currency: this.currency,
64+
message: this.message,
65+
createdAt: this.createdAt && Date.parse(this.createdAt),
66+
skip_alert: this.skipAlert,
67+
},
68+
});
69+
if (response?.donation_id) {
70+
$.export("$summary", `Successfully created donation with ID: ${response.donation_id}`);
71+
}
72+
return response;
73+
},
74+
};
Lines changed: 54 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,74 @@
11
import streamlabs from "../../streamlabs.app.mjs";
2-
import { axios } from "@pipedream/platform";
32

43
export default {
54
key: "streamlabs-send-alert",
65
name: "Send Alert",
7-
description: "Sends an alert to the stream overlay with a custom message, image, and sound. [See the documentation]()",
8-
version: "0.0.{{ts}}",
6+
description: "Sends an alert to the stream overlay with a custom message, image, and sound. [See the documentation](https://dev.streamlabs.com/reference/alerts)",
7+
version: "0.0.1",
98
type: "action",
109
props: {
11-
streamlabs: {
12-
type: "app",
13-
app: "streamlabs",
14-
},
15-
alertMessageContent: {
16-
propDefinition: [
17-
streamlabs,
18-
"alertMessageContent",
10+
streamlabs,
11+
type: {
12+
type: "string",
13+
label: "Type",
14+
description: "determines which alert box this alert will show up in",
15+
options: [
16+
"follow",
17+
"subscription",
18+
"donation",
19+
"host",
1920
],
2021
},
21-
alertImageUrl: {
22-
propDefinition: [
23-
streamlabs,
24-
"alertImageUrl",
25-
],
22+
message: {
23+
type: "string",
24+
label: "Message",
25+
description: "The message to show with this alert",
26+
},
27+
imageHref: {
28+
type: "string",
29+
label: "Image HREF",
30+
description: "The href pointing to an image resource to play when this alert shows",
2631
optional: true,
2732
},
28-
alertSoundUrl: {
29-
propDefinition: [
30-
streamlabs,
31-
"alertSoundUrl",
32-
],
33+
soundHref: {
34+
type: "string",
35+
label: "Sound HREF",
36+
description: "The href pointing to a sound resource to play when this alert shows",
37+
optional: true,
38+
},
39+
userMessage: {
40+
type: "string",
41+
label: "User Message",
42+
description: "Acting as the second heading, this shows below message",
43+
optional: true,
44+
},
45+
duration: {
46+
type: "string",
47+
label: "Duration",
48+
description: "How many seconds this alert should be displayed. Value should be in milliseconds. Ex: `1000` for 1 second.",
49+
optional: true,
50+
},
51+
specialTextColor: {
52+
type: "string",
53+
label: "Special Text Color",
54+
description: "The color to use for special tokens. Must be a valid CSS color string",
3355
optional: true,
3456
},
3557
},
3658
async run({ $ }) {
3759
const response = await this.streamlabs.sendAlert({
38-
alertMessageContent: this.alertMessageContent,
39-
alertImageUrl: this.alertImageUrl,
40-
alertSoundUrl: this.alertSoundUrl,
60+
$,
61+
data: {
62+
type: this.type,
63+
message: this.message,
64+
image_href: this.imageHref,
65+
sound_href: this.soundHref,
66+
user_message: this.userMessage,
67+
duration: this.duration,
68+
special_text_color: this.specialTextColor,
69+
},
4170
});
42-
$.export("$summary", `Alert sent with message: ${this.alertMessageContent}`);
71+
$.export("$summary", `Alert sent with message: ${this.message}`);
4372
return response;
4473
},
4574
};
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
import streamlabs from "../../streamlabs.app.mjs";
2+
3+
export default {
4+
key: "streamlabs-send-test-alert",
5+
name: "Send Test Alert",
6+
description: "Send a test alert to the stream overlay in StreamLabs. [See the documentation](https://dev.streamlabs.com/reference/alertssend_test_alert)",
7+
version: "0.0.1",
8+
type: "action",
9+
props: {
10+
streamlabs,
11+
platform: {
12+
type: "string",
13+
label: "Platform",
14+
description: "The streaming platform",
15+
options: [
16+
"twitch",
17+
"youtube",
18+
],
19+
reloadProps: true,
20+
},
21+
},
22+
additionalProps() {
23+
if (!this.platform) {
24+
return {};
25+
}
26+
const props = {
27+
type: {
28+
type: "string",
29+
label: "Type",
30+
description: "The type of the alert",
31+
},
32+
};
33+
if (this.platform === "twitch") {
34+
props.type.options = [
35+
"follow",
36+
"subscription",
37+
"donation",
38+
"host",
39+
"bits",
40+
"raid",
41+
];
42+
}
43+
if (this.platform === "youtube") {
44+
props.type.options = [
45+
"subscription",
46+
"sponsor",
47+
"superchat",
48+
"donation",
49+
];
50+
}
51+
return props;
52+
},
53+
async run({ $ }) {
54+
const response = await this.streamlabs.sendTestAlert({
55+
$,
56+
data: {
57+
platform: this.platform,
58+
type: this.type,
59+
},
60+
});
61+
$.export("$summary", "Successfully sent test alert");
62+
return response;
63+
},
64+
};

components/streamlabs/actions/start-stream/start-stream.mjs

Lines changed: 0 additions & 34 deletions
This file was deleted.

components/streamlabs/actions/update-overlay/update-overlay.mjs

Lines changed: 0 additions & 33 deletions
This file was deleted.
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
export default [
2+
{
3+
value: "USD",
4+
label: "US Dollar",
5+
},
6+
{
7+
value: "AUD",
8+
label: "Australian Dollar",
9+
},
10+
{
11+
value: "BRL",
12+
label: "Brazilian Real",
13+
},
14+
{
15+
value: "CAD",
16+
label: "Canadian Dollar",
17+
},
18+
{
19+
value: "CZK",
20+
label: "Czech Koruna",
21+
},
22+
{
23+
value: "DKK",
24+
label: "Danish Krone",
25+
},
26+
{
27+
value: "EUR",
28+
label: "Euro",
29+
},
30+
{
31+
value: "HKD",
32+
label: "Hong Kong Dollar",
33+
},
34+
{
35+
value: "ILS",
36+
label: "Israeli New Sheqel",
37+
},
38+
{
39+
value: "MYR",
40+
label: "Malaysian Ringgit",
41+
},
42+
{
43+
value: "MXN",
44+
label: "Mexican Peso",
45+
},
46+
{
47+
value: "NOK",
48+
label: "Norwegian Krone",
49+
},
50+
{
51+
value: "NZD",
52+
label: "New Zealand Dollar",
53+
},
54+
{
55+
value: "PHP",
56+
label: "Philippine Peso",
57+
},
58+
{
59+
value: "PLN",
60+
label: "Polish Zloty",
61+
},
62+
{
63+
value: "GBP",
64+
label: "Pound Sterling",
65+
},
66+
{
67+
value: "RUB",
68+
label: "Russian Ruble",
69+
},
70+
{
71+
value: "SGD",
72+
label: "Singapore Dollar",
73+
},
74+
{
75+
value: "SEK",
76+
label: "Swedish Krona",
77+
},
78+
{
79+
value: "CHF",
80+
label: "Swiss Franc",
81+
},
82+
{
83+
value: "THB",
84+
label: "Thai Baht",
85+
},
86+
{
87+
value: "TRY",
88+
label: "Turkish Lira",
89+
},
90+
];

0 commit comments

Comments
 (0)