@yuniruyuni/n8n-nodes-twitch 0.1.7 → 0.1.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/credentials/TwitchOAuth2Api.credentials.js +3 -9
- package/dist/credentials/TwitchOAuth2Api.credentials.js.map +1 -1
- package/dist/nodes/Twitch/Twitch.node.js +0 -2
- package/dist/nodes/Twitch/Twitch.node.js.map +1 -1
- package/dist/nodes/Twitch/resources/Announcement.js +43 -51
- package/dist/nodes/Twitch/resources/Announcement.js.map +1 -1
- package/dist/nodes/Twitch/resources/Ban.js +36 -47
- package/dist/nodes/Twitch/resources/Ban.js.map +1 -1
- package/dist/nodes/Twitch/resources/BitsLeaderboard.js +54 -68
- package/dist/nodes/Twitch/resources/BitsLeaderboard.js.map +1 -1
- package/dist/nodes/Twitch/resources/Channel.js +15 -1
- package/dist/nodes/Twitch/resources/Channel.js.map +1 -1
- package/dist/nodes/Twitch/resources/ChatMessage.js +26 -34
- package/dist/nodes/Twitch/resources/ChatMessage.js.map +1 -1
- package/dist/nodes/Twitch/resources/Chatter.js +1 -1
- package/dist/nodes/Twitch/resources/Chatter.js.map +1 -1
- package/dist/nodes/Twitch/resources/Cheermote.js +1 -1
- package/dist/nodes/Twitch/resources/Cheermote.js.map +1 -1
- package/dist/nodes/Twitch/resources/Clip.js +91 -104
- package/dist/nodes/Twitch/resources/Clip.js.map +1 -1
- package/dist/nodes/Twitch/resources/CustomReward.js +316 -289
- package/dist/nodes/Twitch/resources/CustomReward.js.map +1 -1
- package/dist/nodes/Twitch/resources/Emote.js +1 -1
- package/dist/nodes/Twitch/resources/Emote.js.map +1 -1
- package/dist/nodes/Twitch/resources/Game.js +68 -74
- package/dist/nodes/Twitch/resources/Game.js.map +1 -1
- package/dist/nodes/Twitch/resources/Moderator.js +75 -15
- package/dist/nodes/Twitch/resources/Moderator.js.map +1 -1
- package/dist/nodes/Twitch/resources/Poll.js +174 -167
- package/dist/nodes/Twitch/resources/Poll.js.map +1 -1
- package/dist/nodes/Twitch/resources/Prediction.js +143 -139
- package/dist/nodes/Twitch/resources/Prediction.js.map +1 -1
- package/dist/nodes/Twitch/resources/Raid.js +48 -56
- package/dist/nodes/Twitch/resources/Raid.js.map +1 -1
- package/dist/nodes/Twitch/resources/Redemption.js +136 -114
- package/dist/nodes/Twitch/resources/Redemption.js.map +1 -1
- package/dist/nodes/Twitch/resources/Schedule.js +226 -186
- package/dist/nodes/Twitch/resources/Schedule.js.map +1 -1
- package/dist/nodes/Twitch/resources/Search.js +24 -23
- package/dist/nodes/Twitch/resources/Search.js.map +1 -1
- package/dist/nodes/Twitch/resources/Stream.js +13 -15
- package/dist/nodes/Twitch/resources/Stream.js.map +1 -1
- package/dist/nodes/Twitch/resources/Subscription.js +61 -29
- package/dist/nodes/Twitch/resources/Subscription.js.map +1 -1
- package/dist/nodes/Twitch/resources/Team.js +63 -57
- package/dist/nodes/Twitch/resources/Team.js.map +1 -1
- package/dist/nodes/Twitch/resources/User.js +13 -15
- package/dist/nodes/Twitch/resources/User.js.map +1 -1
- package/dist/nodes/Twitch/resources/Video.js +129 -125
- package/dist/nodes/Twitch/resources/Video.js.map +1 -1
- package/dist/nodes/Twitch/resources/Whisper.js +32 -28
- package/dist/nodes/Twitch/resources/Whisper.js.map +1 -1
- package/dist/nodes/Twitch/shared/updateDisplayOptions.d.ts +2 -0
- package/dist/nodes/Twitch/shared/updateDisplayOptions.js +12 -0
- package/dist/nodes/Twitch/shared/updateDisplayOptions.js.map +1 -0
- package/dist/package.json +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/nodes/Twitch/resources/CommonFields.d.ts +0 -2
- package/dist/nodes/Twitch/resources/CommonFields.js +0 -241
- package/dist/nodes/Twitch/resources/CommonFields.js.map +0 -1
|
@@ -2,257 +2,21 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.customRewardFields = exports.customRewardOperations = void 0;
|
|
4
4
|
const userIdConverter_1 = require("../shared/userIdConverter");
|
|
5
|
-
|
|
5
|
+
const updateDisplayOptions_1 = require("../shared/updateDisplayOptions");
|
|
6
|
+
const createFields = [
|
|
6
7
|
{
|
|
7
|
-
displayName: '
|
|
8
|
-
name: '
|
|
9
|
-
type: '
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
options: [
|
|
17
|
-
{
|
|
18
|
-
name: 'Create',
|
|
19
|
-
value: 'create',
|
|
20
|
-
action: 'Create a custom reward',
|
|
21
|
-
description: 'Create a custom channel points reward',
|
|
22
|
-
routing: {
|
|
23
|
-
request: {
|
|
24
|
-
method: 'POST',
|
|
25
|
-
url: '/channel_points/custom_rewards',
|
|
26
|
-
},
|
|
27
|
-
send: {
|
|
28
|
-
preSend: [
|
|
29
|
-
async function (requestOptions) {
|
|
30
|
-
const broadcasterIdInput = this.getNodeParameter('broadcasterId', 0);
|
|
31
|
-
const broadcasterId = await userIdConverter_1.resolveUserIdOrUsername.call(this, broadcasterIdInput);
|
|
32
|
-
requestOptions.qs = { broadcaster_id: broadcasterId };
|
|
33
|
-
const body = {
|
|
34
|
-
title: this.getNodeParameter('title', 0),
|
|
35
|
-
cost: this.getNodeParameter('cost', 0),
|
|
36
|
-
};
|
|
37
|
-
const additionalFields = this.getNodeParameter('additionalFields', 0, {});
|
|
38
|
-
if (additionalFields.prompt) {
|
|
39
|
-
body.prompt = additionalFields.prompt;
|
|
40
|
-
}
|
|
41
|
-
if (additionalFields.isEnabled !== undefined) {
|
|
42
|
-
body.is_enabled = additionalFields.isEnabled;
|
|
43
|
-
}
|
|
44
|
-
if (additionalFields.backgroundColor) {
|
|
45
|
-
body.background_color = additionalFields.backgroundColor;
|
|
46
|
-
}
|
|
47
|
-
if (additionalFields.isUserInputRequired !== undefined) {
|
|
48
|
-
body.is_user_input_required = additionalFields.isUserInputRequired;
|
|
49
|
-
}
|
|
50
|
-
if (additionalFields.isMaxPerStreamEnabled !== undefined) {
|
|
51
|
-
body.is_max_per_stream_enabled = additionalFields.isMaxPerStreamEnabled;
|
|
52
|
-
}
|
|
53
|
-
if (additionalFields.maxPerStream) {
|
|
54
|
-
body.max_per_stream = additionalFields.maxPerStream;
|
|
55
|
-
}
|
|
56
|
-
if (additionalFields.isMaxPerUserPerStreamEnabled !== undefined) {
|
|
57
|
-
body.is_max_per_user_per_stream_enabled = additionalFields.isMaxPerUserPerStreamEnabled;
|
|
58
|
-
}
|
|
59
|
-
if (additionalFields.maxPerUserPerStream) {
|
|
60
|
-
body.max_per_user_per_stream = additionalFields.maxPerUserPerStream;
|
|
61
|
-
}
|
|
62
|
-
if (additionalFields.isGlobalCooldownEnabled !== undefined) {
|
|
63
|
-
body.is_global_cooldown_enabled = additionalFields.isGlobalCooldownEnabled;
|
|
64
|
-
}
|
|
65
|
-
if (additionalFields.globalCooldownSeconds) {
|
|
66
|
-
body.global_cooldown_seconds = additionalFields.globalCooldownSeconds;
|
|
67
|
-
}
|
|
68
|
-
if (additionalFields.shouldRedemptionsSkipRequestQueue !== undefined) {
|
|
69
|
-
body.should_redemptions_skip_request_queue = additionalFields.shouldRedemptionsSkipRequestQueue;
|
|
70
|
-
}
|
|
71
|
-
requestOptions.body = body;
|
|
72
|
-
return requestOptions;
|
|
73
|
-
},
|
|
74
|
-
],
|
|
75
|
-
},
|
|
76
|
-
output: {
|
|
77
|
-
postReceive: [
|
|
78
|
-
{
|
|
79
|
-
type: 'rootProperty',
|
|
80
|
-
properties: {
|
|
81
|
-
property: 'data',
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
{
|
|
85
|
-
type: 'setKeyValue',
|
|
86
|
-
properties: {
|
|
87
|
-
index: 0,
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
],
|
|
91
|
-
},
|
|
92
|
-
},
|
|
93
|
-
},
|
|
94
|
-
{
|
|
95
|
-
name: 'Get',
|
|
96
|
-
value: 'get',
|
|
97
|
-
action: 'Get custom rewards',
|
|
98
|
-
description: 'Get custom channel points rewards for a broadcaster',
|
|
99
|
-
routing: {
|
|
100
|
-
request: {
|
|
101
|
-
method: 'GET',
|
|
102
|
-
url: '/channel_points/custom_rewards',
|
|
103
|
-
},
|
|
104
|
-
send: {
|
|
105
|
-
preSend: [
|
|
106
|
-
async function (requestOptions) {
|
|
107
|
-
const broadcasterIdInput = this.getNodeParameter('broadcasterId', 0);
|
|
108
|
-
const broadcasterId = await userIdConverter_1.resolveUserIdOrUsername.call(this, broadcasterIdInput);
|
|
109
|
-
const qs = { broadcaster_id: broadcasterId };
|
|
110
|
-
const additionalFields = this.getNodeParameter('additionalFields', 0, {});
|
|
111
|
-
if (additionalFields.id) {
|
|
112
|
-
qs.id = additionalFields.id;
|
|
113
|
-
}
|
|
114
|
-
if (additionalFields.onlyManageableRewards !== undefined) {
|
|
115
|
-
qs.only_manageable_rewards = additionalFields.onlyManageableRewards;
|
|
116
|
-
}
|
|
117
|
-
requestOptions.qs = qs;
|
|
118
|
-
return requestOptions;
|
|
119
|
-
},
|
|
120
|
-
],
|
|
121
|
-
},
|
|
122
|
-
output: {
|
|
123
|
-
postReceive: [
|
|
124
|
-
{
|
|
125
|
-
type: 'rootProperty',
|
|
126
|
-
properties: {
|
|
127
|
-
property: 'data',
|
|
128
|
-
},
|
|
129
|
-
},
|
|
130
|
-
],
|
|
131
|
-
},
|
|
132
|
-
},
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
name: 'Update',
|
|
136
|
-
value: 'update',
|
|
137
|
-
action: 'Update a custom reward',
|
|
138
|
-
description: 'Update a custom channel points reward',
|
|
139
|
-
routing: {
|
|
140
|
-
request: {
|
|
141
|
-
method: 'PATCH',
|
|
142
|
-
url: '/channel_points/custom_rewards',
|
|
143
|
-
},
|
|
144
|
-
send: {
|
|
145
|
-
preSend: [
|
|
146
|
-
async function (requestOptions) {
|
|
147
|
-
const broadcasterIdInput = this.getNodeParameter('broadcasterId', 0);
|
|
148
|
-
const broadcasterId = await userIdConverter_1.resolveUserIdOrUsername.call(this, broadcasterIdInput);
|
|
149
|
-
const id = this.getNodeParameter('rewardId', 0);
|
|
150
|
-
requestOptions.qs = { broadcaster_id: broadcasterId, id };
|
|
151
|
-
const body = {};
|
|
152
|
-
const updateFields = this.getNodeParameter('updateFields', 0, {});
|
|
153
|
-
if (updateFields.title) {
|
|
154
|
-
body.title = updateFields.title;
|
|
155
|
-
}
|
|
156
|
-
if (updateFields.cost) {
|
|
157
|
-
body.cost = updateFields.cost;
|
|
158
|
-
}
|
|
159
|
-
if (updateFields.prompt !== undefined) {
|
|
160
|
-
body.prompt = updateFields.prompt;
|
|
161
|
-
}
|
|
162
|
-
if (updateFields.isEnabled !== undefined) {
|
|
163
|
-
body.is_enabled = updateFields.isEnabled;
|
|
164
|
-
}
|
|
165
|
-
if (updateFields.backgroundColor) {
|
|
166
|
-
body.background_color = updateFields.backgroundColor;
|
|
167
|
-
}
|
|
168
|
-
if (updateFields.isUserInputRequired !== undefined) {
|
|
169
|
-
body.is_user_input_required = updateFields.isUserInputRequired;
|
|
170
|
-
}
|
|
171
|
-
if (updateFields.isMaxPerStreamEnabled !== undefined) {
|
|
172
|
-
body.is_max_per_stream_enabled = updateFields.isMaxPerStreamEnabled;
|
|
173
|
-
}
|
|
174
|
-
if (updateFields.maxPerStream) {
|
|
175
|
-
body.max_per_stream = updateFields.maxPerStream;
|
|
176
|
-
}
|
|
177
|
-
if (updateFields.isMaxPerUserPerStreamEnabled !== undefined) {
|
|
178
|
-
body.is_max_per_user_per_stream_enabled = updateFields.isMaxPerUserPerStreamEnabled;
|
|
179
|
-
}
|
|
180
|
-
if (updateFields.maxPerUserPerStream) {
|
|
181
|
-
body.max_per_user_per_stream = updateFields.maxPerUserPerStream;
|
|
182
|
-
}
|
|
183
|
-
if (updateFields.isGlobalCooldownEnabled !== undefined) {
|
|
184
|
-
body.is_global_cooldown_enabled = updateFields.isGlobalCooldownEnabled;
|
|
185
|
-
}
|
|
186
|
-
if (updateFields.globalCooldownSeconds) {
|
|
187
|
-
body.global_cooldown_seconds = updateFields.globalCooldownSeconds;
|
|
188
|
-
}
|
|
189
|
-
if (updateFields.isPaused !== undefined) {
|
|
190
|
-
body.is_paused = updateFields.isPaused;
|
|
191
|
-
}
|
|
192
|
-
if (updateFields.shouldRedemptionsSkipRequestQueue !== undefined) {
|
|
193
|
-
body.should_redemptions_skip_request_queue = updateFields.shouldRedemptionsSkipRequestQueue;
|
|
194
|
-
}
|
|
195
|
-
requestOptions.body = body;
|
|
196
|
-
return requestOptions;
|
|
197
|
-
},
|
|
198
|
-
],
|
|
199
|
-
},
|
|
200
|
-
output: {
|
|
201
|
-
postReceive: [
|
|
202
|
-
{
|
|
203
|
-
type: 'rootProperty',
|
|
204
|
-
properties: {
|
|
205
|
-
property: 'data',
|
|
206
|
-
},
|
|
207
|
-
},
|
|
208
|
-
{
|
|
209
|
-
type: 'setKeyValue',
|
|
210
|
-
properties: {
|
|
211
|
-
index: 0,
|
|
212
|
-
},
|
|
213
|
-
},
|
|
214
|
-
],
|
|
215
|
-
},
|
|
216
|
-
},
|
|
217
|
-
},
|
|
218
|
-
{
|
|
219
|
-
name: 'Delete',
|
|
220
|
-
value: 'delete',
|
|
221
|
-
action: 'Delete a custom reward',
|
|
222
|
-
description: 'Delete a custom channel points reward',
|
|
223
|
-
routing: {
|
|
224
|
-
request: {
|
|
225
|
-
method: 'DELETE',
|
|
226
|
-
url: '/channel_points/custom_rewards',
|
|
227
|
-
},
|
|
228
|
-
send: {
|
|
229
|
-
preSend: [
|
|
230
|
-
async function (requestOptions) {
|
|
231
|
-
const broadcasterIdInput = this.getNodeParameter('broadcasterId', 0);
|
|
232
|
-
const broadcasterId = await userIdConverter_1.resolveUserIdOrUsername.call(this, broadcasterIdInput);
|
|
233
|
-
const id = this.getNodeParameter('rewardId', 0);
|
|
234
|
-
requestOptions.qs = { broadcaster_id: broadcasterId, id };
|
|
235
|
-
return requestOptions;
|
|
236
|
-
},
|
|
237
|
-
],
|
|
238
|
-
},
|
|
239
|
-
},
|
|
240
|
-
},
|
|
241
|
-
],
|
|
242
|
-
default: 'get',
|
|
8
|
+
displayName: 'Broadcaster ID or Username',
|
|
9
|
+
name: 'broadcasterId',
|
|
10
|
+
type: 'string',
|
|
11
|
+
default: '',
|
|
12
|
+
required: true,
|
|
13
|
+
placeholder: 'e.g. 123456789 or username',
|
|
14
|
+
description: 'The broadcaster user ID or username. If a username is provided, it will be automatically converted to user ID.',
|
|
243
15
|
},
|
|
244
|
-
];
|
|
245
|
-
exports.customRewardFields = [
|
|
246
16
|
{
|
|
247
17
|
displayName: 'Title',
|
|
248
18
|
name: 'title',
|
|
249
19
|
type: 'string',
|
|
250
|
-
displayOptions: {
|
|
251
|
-
show: {
|
|
252
|
-
resource: ['customReward'],
|
|
253
|
-
operation: ['create'],
|
|
254
|
-
},
|
|
255
|
-
},
|
|
256
20
|
default: '',
|
|
257
21
|
required: true,
|
|
258
22
|
placeholder: 'e.g. My Custom Reward',
|
|
@@ -262,12 +26,6 @@ exports.customRewardFields = [
|
|
|
262
26
|
displayName: 'Cost',
|
|
263
27
|
name: 'cost',
|
|
264
28
|
type: 'number',
|
|
265
|
-
displayOptions: {
|
|
266
|
-
show: {
|
|
267
|
-
resource: ['customReward'],
|
|
268
|
-
operation: ['create'],
|
|
269
|
-
},
|
|
270
|
-
},
|
|
271
29
|
default: 100,
|
|
272
30
|
required: true,
|
|
273
31
|
typeOptions: {
|
|
@@ -281,12 +39,6 @@ exports.customRewardFields = [
|
|
|
281
39
|
type: 'collection',
|
|
282
40
|
placeholder: 'Add Field',
|
|
283
41
|
default: {},
|
|
284
|
-
displayOptions: {
|
|
285
|
-
show: {
|
|
286
|
-
resource: ['customReward'],
|
|
287
|
-
operation: ['create', 'get'],
|
|
288
|
-
},
|
|
289
|
-
},
|
|
290
42
|
options: [
|
|
291
43
|
{
|
|
292
44
|
displayName: 'Background Color',
|
|
@@ -361,18 +113,6 @@ exports.customRewardFields = [
|
|
|
361
113
|
},
|
|
362
114
|
description: 'The maximum number of redemptions allowed per user per stream',
|
|
363
115
|
},
|
|
364
|
-
{
|
|
365
|
-
displayName: 'Only Manageable Rewards',
|
|
366
|
-
name: 'onlyManageableRewards',
|
|
367
|
-
type: 'boolean',
|
|
368
|
-
default: false,
|
|
369
|
-
description: 'Whether to filter the results and only return custom rewards that the calling client_id can manage',
|
|
370
|
-
displayOptions: {
|
|
371
|
-
show: {
|
|
372
|
-
'/operation': ['get'],
|
|
373
|
-
},
|
|
374
|
-
},
|
|
375
|
-
},
|
|
376
116
|
{
|
|
377
117
|
displayName: 'Prompt',
|
|
378
118
|
name: 'prompt',
|
|
@@ -381,6 +121,33 @@ exports.customRewardFields = [
|
|
|
381
121
|
placeholder: 'e.g. Enter your message here',
|
|
382
122
|
description: 'The prompt shown to the viewer when redeeming the reward (max 200 characters)',
|
|
383
123
|
},
|
|
124
|
+
{
|
|
125
|
+
displayName: 'Should Redemptions Skip Request Queue',
|
|
126
|
+
name: 'shouldRedemptionsSkipRequestQueue',
|
|
127
|
+
type: 'boolean',
|
|
128
|
+
default: false,
|
|
129
|
+
description: 'Whether redemptions should be automatically fulfilled',
|
|
130
|
+
},
|
|
131
|
+
],
|
|
132
|
+
},
|
|
133
|
+
];
|
|
134
|
+
const getFields = [
|
|
135
|
+
{
|
|
136
|
+
displayName: 'Broadcaster ID or Username',
|
|
137
|
+
name: 'broadcasterId',
|
|
138
|
+
type: 'string',
|
|
139
|
+
default: '',
|
|
140
|
+
required: true,
|
|
141
|
+
placeholder: 'e.g. 123456789 or username',
|
|
142
|
+
description: 'The broadcaster user ID or username. If a username is provided, it will be automatically converted to user ID.',
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
displayName: 'Additional Fields',
|
|
146
|
+
name: 'additionalFields',
|
|
147
|
+
type: 'collection',
|
|
148
|
+
placeholder: 'Add Field',
|
|
149
|
+
default: {},
|
|
150
|
+
options: [
|
|
384
151
|
{
|
|
385
152
|
displayName: 'Reward ID',
|
|
386
153
|
name: 'id',
|
|
@@ -388,31 +155,31 @@ exports.customRewardFields = [
|
|
|
388
155
|
default: '',
|
|
389
156
|
placeholder: 'e.g. 92af127c-7326-4483-a52b-b0da0be61c01',
|
|
390
157
|
description: 'The ID of the custom reward to get (if not specified, returns all rewards)',
|
|
391
|
-
displayOptions: {
|
|
392
|
-
show: {
|
|
393
|
-
'/operation': ['get'],
|
|
394
|
-
},
|
|
395
|
-
},
|
|
396
158
|
},
|
|
397
159
|
{
|
|
398
|
-
displayName: '
|
|
399
|
-
name: '
|
|
160
|
+
displayName: 'Only Manageable Rewards',
|
|
161
|
+
name: 'onlyManageableRewards',
|
|
400
162
|
type: 'boolean',
|
|
401
163
|
default: false,
|
|
402
|
-
description: 'Whether
|
|
164
|
+
description: 'Whether to filter the results and only return custom rewards that the calling client_id can manage',
|
|
403
165
|
},
|
|
404
166
|
],
|
|
405
167
|
},
|
|
168
|
+
];
|
|
169
|
+
const updateFields = [
|
|
170
|
+
{
|
|
171
|
+
displayName: 'Broadcaster ID or Username',
|
|
172
|
+
name: 'broadcasterId',
|
|
173
|
+
type: 'string',
|
|
174
|
+
default: '',
|
|
175
|
+
required: true,
|
|
176
|
+
placeholder: 'e.g. 123456789 or username',
|
|
177
|
+
description: 'The broadcaster user ID or username. If a username is provided, it will be automatically converted to user ID.',
|
|
178
|
+
},
|
|
406
179
|
{
|
|
407
180
|
displayName: 'Reward ID',
|
|
408
181
|
name: 'rewardId',
|
|
409
182
|
type: 'string',
|
|
410
|
-
displayOptions: {
|
|
411
|
-
show: {
|
|
412
|
-
resource: ['customReward'],
|
|
413
|
-
operation: ['update', 'delete'],
|
|
414
|
-
},
|
|
415
|
-
},
|
|
416
183
|
default: '',
|
|
417
184
|
required: true,
|
|
418
185
|
placeholder: 'e.g. 92af127c-7326-4483-a52b-b0da0be61c01',
|
|
@@ -424,12 +191,6 @@ exports.customRewardFields = [
|
|
|
424
191
|
type: 'collection',
|
|
425
192
|
placeholder: 'Add Field',
|
|
426
193
|
default: {},
|
|
427
|
-
displayOptions: {
|
|
428
|
-
show: {
|
|
429
|
-
resource: ['customReward'],
|
|
430
|
-
operation: ['update'],
|
|
431
|
-
},
|
|
432
|
-
},
|
|
433
194
|
options: [
|
|
434
195
|
{
|
|
435
196
|
displayName: 'Background Color',
|
|
@@ -547,4 +308,270 @@ exports.customRewardFields = [
|
|
|
547
308
|
],
|
|
548
309
|
},
|
|
549
310
|
];
|
|
311
|
+
const deleteFields = [
|
|
312
|
+
{
|
|
313
|
+
displayName: 'Broadcaster ID or Username',
|
|
314
|
+
name: 'broadcasterId',
|
|
315
|
+
type: 'string',
|
|
316
|
+
default: '',
|
|
317
|
+
required: true,
|
|
318
|
+
placeholder: 'e.g. 123456789 or username',
|
|
319
|
+
description: 'The broadcaster user ID or username. If a username is provided, it will be automatically converted to user ID.',
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
displayName: 'Reward ID',
|
|
323
|
+
name: 'rewardId',
|
|
324
|
+
type: 'string',
|
|
325
|
+
default: '',
|
|
326
|
+
required: true,
|
|
327
|
+
placeholder: 'e.g. 92af127c-7326-4483-a52b-b0da0be61c01',
|
|
328
|
+
description: 'The ID of the custom reward',
|
|
329
|
+
},
|
|
330
|
+
];
|
|
331
|
+
exports.customRewardOperations = [
|
|
332
|
+
{
|
|
333
|
+
displayName: 'Operation',
|
|
334
|
+
name: 'operation',
|
|
335
|
+
type: 'options',
|
|
336
|
+
noDataExpression: true,
|
|
337
|
+
displayOptions: {
|
|
338
|
+
show: {
|
|
339
|
+
resource: ['customReward'],
|
|
340
|
+
},
|
|
341
|
+
},
|
|
342
|
+
options: [
|
|
343
|
+
{
|
|
344
|
+
name: 'Create',
|
|
345
|
+
value: 'create',
|
|
346
|
+
action: 'Create a custom reward',
|
|
347
|
+
description: 'Create a custom channel points reward',
|
|
348
|
+
routing: {
|
|
349
|
+
request: {
|
|
350
|
+
method: 'POST',
|
|
351
|
+
url: '/channel_points/custom_rewards',
|
|
352
|
+
},
|
|
353
|
+
send: {
|
|
354
|
+
preSend: [
|
|
355
|
+
async function (requestOptions) {
|
|
356
|
+
const broadcasterIdInput = this.getNodeParameter('broadcasterId', 0);
|
|
357
|
+
const broadcasterId = await userIdConverter_1.resolveUserIdOrUsername.call(this, broadcasterIdInput);
|
|
358
|
+
requestOptions.qs = { broadcaster_id: broadcasterId };
|
|
359
|
+
const body = {
|
|
360
|
+
title: this.getNodeParameter('title', 0),
|
|
361
|
+
cost: this.getNodeParameter('cost', 0),
|
|
362
|
+
};
|
|
363
|
+
const additionalFields = this.getNodeParameter('additionalFields', 0, {});
|
|
364
|
+
if (additionalFields.prompt) {
|
|
365
|
+
body.prompt = additionalFields.prompt;
|
|
366
|
+
}
|
|
367
|
+
if (additionalFields.isEnabled !== undefined) {
|
|
368
|
+
body.is_enabled = additionalFields.isEnabled;
|
|
369
|
+
}
|
|
370
|
+
if (additionalFields.backgroundColor) {
|
|
371
|
+
body.background_color = additionalFields.backgroundColor;
|
|
372
|
+
}
|
|
373
|
+
if (additionalFields.isUserInputRequired !== undefined) {
|
|
374
|
+
body.is_user_input_required = additionalFields.isUserInputRequired;
|
|
375
|
+
}
|
|
376
|
+
if (additionalFields.isMaxPerStreamEnabled !== undefined) {
|
|
377
|
+
body.is_max_per_stream_enabled = additionalFields.isMaxPerStreamEnabled;
|
|
378
|
+
}
|
|
379
|
+
if (additionalFields.maxPerStream) {
|
|
380
|
+
body.max_per_stream = additionalFields.maxPerStream;
|
|
381
|
+
}
|
|
382
|
+
if (additionalFields.isMaxPerUserPerStreamEnabled !== undefined) {
|
|
383
|
+
body.is_max_per_user_per_stream_enabled = additionalFields.isMaxPerUserPerStreamEnabled;
|
|
384
|
+
}
|
|
385
|
+
if (additionalFields.maxPerUserPerStream) {
|
|
386
|
+
body.max_per_user_per_stream = additionalFields.maxPerUserPerStream;
|
|
387
|
+
}
|
|
388
|
+
if (additionalFields.isGlobalCooldownEnabled !== undefined) {
|
|
389
|
+
body.is_global_cooldown_enabled = additionalFields.isGlobalCooldownEnabled;
|
|
390
|
+
}
|
|
391
|
+
if (additionalFields.globalCooldownSeconds) {
|
|
392
|
+
body.global_cooldown_seconds = additionalFields.globalCooldownSeconds;
|
|
393
|
+
}
|
|
394
|
+
if (additionalFields.shouldRedemptionsSkipRequestQueue !== undefined) {
|
|
395
|
+
body.should_redemptions_skip_request_queue = additionalFields.shouldRedemptionsSkipRequestQueue;
|
|
396
|
+
}
|
|
397
|
+
requestOptions.body = body;
|
|
398
|
+
return requestOptions;
|
|
399
|
+
},
|
|
400
|
+
],
|
|
401
|
+
},
|
|
402
|
+
output: {
|
|
403
|
+
postReceive: [
|
|
404
|
+
{
|
|
405
|
+
type: 'rootProperty',
|
|
406
|
+
properties: {
|
|
407
|
+
property: 'data',
|
|
408
|
+
},
|
|
409
|
+
},
|
|
410
|
+
{
|
|
411
|
+
type: 'setKeyValue',
|
|
412
|
+
properties: {
|
|
413
|
+
index: 0,
|
|
414
|
+
},
|
|
415
|
+
},
|
|
416
|
+
],
|
|
417
|
+
},
|
|
418
|
+
},
|
|
419
|
+
},
|
|
420
|
+
{
|
|
421
|
+
name: 'Get',
|
|
422
|
+
value: 'get',
|
|
423
|
+
action: 'Get custom rewards',
|
|
424
|
+
description: 'Get custom channel points rewards for a broadcaster',
|
|
425
|
+
routing: {
|
|
426
|
+
request: {
|
|
427
|
+
method: 'GET',
|
|
428
|
+
url: '/channel_points/custom_rewards',
|
|
429
|
+
},
|
|
430
|
+
send: {
|
|
431
|
+
preSend: [
|
|
432
|
+
async function (requestOptions) {
|
|
433
|
+
const broadcasterIdInput = this.getNodeParameter('broadcasterId', 0);
|
|
434
|
+
const broadcasterId = await userIdConverter_1.resolveUserIdOrUsername.call(this, broadcasterIdInput);
|
|
435
|
+
const qs = { broadcaster_id: broadcasterId };
|
|
436
|
+
const additionalFields = this.getNodeParameter('additionalFields', 0, {});
|
|
437
|
+
if (additionalFields.id) {
|
|
438
|
+
qs.id = additionalFields.id;
|
|
439
|
+
}
|
|
440
|
+
if (additionalFields.onlyManageableRewards !== undefined) {
|
|
441
|
+
qs.only_manageable_rewards = additionalFields.onlyManageableRewards;
|
|
442
|
+
}
|
|
443
|
+
requestOptions.qs = qs;
|
|
444
|
+
return requestOptions;
|
|
445
|
+
},
|
|
446
|
+
],
|
|
447
|
+
},
|
|
448
|
+
output: {
|
|
449
|
+
postReceive: [
|
|
450
|
+
{
|
|
451
|
+
type: 'rootProperty',
|
|
452
|
+
properties: {
|
|
453
|
+
property: 'data',
|
|
454
|
+
},
|
|
455
|
+
},
|
|
456
|
+
],
|
|
457
|
+
},
|
|
458
|
+
},
|
|
459
|
+
},
|
|
460
|
+
{
|
|
461
|
+
name: 'Update',
|
|
462
|
+
value: 'update',
|
|
463
|
+
action: 'Update a custom reward',
|
|
464
|
+
description: 'Update a custom channel points reward',
|
|
465
|
+
routing: {
|
|
466
|
+
request: {
|
|
467
|
+
method: 'PATCH',
|
|
468
|
+
url: '/channel_points/custom_rewards',
|
|
469
|
+
},
|
|
470
|
+
send: {
|
|
471
|
+
preSend: [
|
|
472
|
+
async function (requestOptions) {
|
|
473
|
+
const broadcasterIdInput = this.getNodeParameter('broadcasterId', 0);
|
|
474
|
+
const broadcasterId = await userIdConverter_1.resolveUserIdOrUsername.call(this, broadcasterIdInput);
|
|
475
|
+
const id = this.getNodeParameter('rewardId', 0);
|
|
476
|
+
requestOptions.qs = { broadcaster_id: broadcasterId, id };
|
|
477
|
+
const body = {};
|
|
478
|
+
const updateFields = this.getNodeParameter('updateFields', 0, {});
|
|
479
|
+
if (updateFields.title) {
|
|
480
|
+
body.title = updateFields.title;
|
|
481
|
+
}
|
|
482
|
+
if (updateFields.cost) {
|
|
483
|
+
body.cost = updateFields.cost;
|
|
484
|
+
}
|
|
485
|
+
if (updateFields.prompt !== undefined) {
|
|
486
|
+
body.prompt = updateFields.prompt;
|
|
487
|
+
}
|
|
488
|
+
if (updateFields.isEnabled !== undefined) {
|
|
489
|
+
body.is_enabled = updateFields.isEnabled;
|
|
490
|
+
}
|
|
491
|
+
if (updateFields.backgroundColor) {
|
|
492
|
+
body.background_color = updateFields.backgroundColor;
|
|
493
|
+
}
|
|
494
|
+
if (updateFields.isUserInputRequired !== undefined) {
|
|
495
|
+
body.is_user_input_required = updateFields.isUserInputRequired;
|
|
496
|
+
}
|
|
497
|
+
if (updateFields.isMaxPerStreamEnabled !== undefined) {
|
|
498
|
+
body.is_max_per_stream_enabled = updateFields.isMaxPerStreamEnabled;
|
|
499
|
+
}
|
|
500
|
+
if (updateFields.maxPerStream) {
|
|
501
|
+
body.max_per_stream = updateFields.maxPerStream;
|
|
502
|
+
}
|
|
503
|
+
if (updateFields.isMaxPerUserPerStreamEnabled !== undefined) {
|
|
504
|
+
body.is_max_per_user_per_stream_enabled = updateFields.isMaxPerUserPerStreamEnabled;
|
|
505
|
+
}
|
|
506
|
+
if (updateFields.maxPerUserPerStream) {
|
|
507
|
+
body.max_per_user_per_stream = updateFields.maxPerUserPerStream;
|
|
508
|
+
}
|
|
509
|
+
if (updateFields.isGlobalCooldownEnabled !== undefined) {
|
|
510
|
+
body.is_global_cooldown_enabled = updateFields.isGlobalCooldownEnabled;
|
|
511
|
+
}
|
|
512
|
+
if (updateFields.globalCooldownSeconds) {
|
|
513
|
+
body.global_cooldown_seconds = updateFields.globalCooldownSeconds;
|
|
514
|
+
}
|
|
515
|
+
if (updateFields.isPaused !== undefined) {
|
|
516
|
+
body.is_paused = updateFields.isPaused;
|
|
517
|
+
}
|
|
518
|
+
if (updateFields.shouldRedemptionsSkipRequestQueue !== undefined) {
|
|
519
|
+
body.should_redemptions_skip_request_queue = updateFields.shouldRedemptionsSkipRequestQueue;
|
|
520
|
+
}
|
|
521
|
+
requestOptions.body = body;
|
|
522
|
+
return requestOptions;
|
|
523
|
+
},
|
|
524
|
+
],
|
|
525
|
+
},
|
|
526
|
+
output: {
|
|
527
|
+
postReceive: [
|
|
528
|
+
{
|
|
529
|
+
type: 'rootProperty',
|
|
530
|
+
properties: {
|
|
531
|
+
property: 'data',
|
|
532
|
+
},
|
|
533
|
+
},
|
|
534
|
+
{
|
|
535
|
+
type: 'setKeyValue',
|
|
536
|
+
properties: {
|
|
537
|
+
index: 0,
|
|
538
|
+
},
|
|
539
|
+
},
|
|
540
|
+
],
|
|
541
|
+
},
|
|
542
|
+
},
|
|
543
|
+
},
|
|
544
|
+
{
|
|
545
|
+
name: 'Delete',
|
|
546
|
+
value: 'delete',
|
|
547
|
+
action: 'Delete a custom reward',
|
|
548
|
+
description: 'Delete a custom channel points reward',
|
|
549
|
+
routing: {
|
|
550
|
+
request: {
|
|
551
|
+
method: 'DELETE',
|
|
552
|
+
url: '/channel_points/custom_rewards',
|
|
553
|
+
},
|
|
554
|
+
send: {
|
|
555
|
+
preSend: [
|
|
556
|
+
async function (requestOptions) {
|
|
557
|
+
const broadcasterIdInput = this.getNodeParameter('broadcasterId', 0);
|
|
558
|
+
const broadcasterId = await userIdConverter_1.resolveUserIdOrUsername.call(this, broadcasterIdInput);
|
|
559
|
+
const id = this.getNodeParameter('rewardId', 0);
|
|
560
|
+
requestOptions.qs = { broadcaster_id: broadcasterId, id };
|
|
561
|
+
return requestOptions;
|
|
562
|
+
},
|
|
563
|
+
],
|
|
564
|
+
},
|
|
565
|
+
},
|
|
566
|
+
},
|
|
567
|
+
],
|
|
568
|
+
default: 'get',
|
|
569
|
+
},
|
|
570
|
+
];
|
|
571
|
+
exports.customRewardFields = [
|
|
572
|
+
...(0, updateDisplayOptions_1.updateDisplayOptions)({ show: { resource: ['customReward'], operation: ['create'] } }, createFields),
|
|
573
|
+
...(0, updateDisplayOptions_1.updateDisplayOptions)({ show: { resource: ['customReward'], operation: ['get'] } }, getFields),
|
|
574
|
+
...(0, updateDisplayOptions_1.updateDisplayOptions)({ show: { resource: ['customReward'], operation: ['update'] } }, updateFields),
|
|
575
|
+
...(0, updateDisplayOptions_1.updateDisplayOptions)({ show: { resource: ['customReward'], operation: ['delete'] } }, deleteFields),
|
|
576
|
+
];
|
|
550
577
|
//# sourceMappingURL=CustomReward.js.map
|