Skip to content

Commit 2a753ea

Browse files
committed
actions updates
1 parent 0acaaeb commit 2a753ea

File tree

29 files changed

+173
-142
lines changed

29 files changed

+173
-142
lines changed

components/youtube_data_api/actions/add-playlist-items/add-playlist-items.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ export default {
55
...common,
66
key: "youtube_data_api-add-playlist-items",
77
name: "Add Playlist Items",
8-
description: "Adds resources to a playlist. [See the docs](https://developers.google.com/youtube/v3/docs/playlistItems/insert) for more information",
9-
version: "0.0.1",
8+
description: "Adds resources to a playlist. [See the documentation](https://developers.google.com/youtube/v3/docs/playlistItems/insert) for more information",
9+
version: "0.0.2",
1010
type: "action",
1111
props: {
1212
youtubeDataApi,
@@ -19,7 +19,7 @@ export default {
1919
videoIds: {
2020
type: "string[]",
2121
label: "Video IDs",
22-
description: "Array of identifiers of the videos to be added to the playlist",
22+
description: "Array of identifiers of the videos to be added to the playlist. E.g. `o_U1CQn68VM` The video ID will be located in the URL of the video page, right after the v= URL parameter",
2323
},
2424
onBehalfOfContentOwner: {
2525
propDefinition: [

components/youtube_data_api/actions/channel-statistics/channel-statistics.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ export default {
66
...common,
77
key: "youtube_data_api-channel-statistics",
88
name: "Channel Statistics",
9-
description: "Returns statistics from my YouTube Channel or by id. [See the docs](https://developers.google.com/youtube/v3/docs/channels/list) for more information",
10-
version: "0.0.3",
9+
description: "Returns statistics from my YouTube Channel or by id. [See the documentation](https://developers.google.com/youtube/v3/docs/channels/list) for more information",
10+
version: "0.0.4",
1111
type: "action",
1212
props: {
1313
youtubeDataApi,

components/youtube_data_api/actions/channel-statistics/common.mjs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,18 @@ export default {
1515
const managedByMe = this.useCase === "managedByMe" ?
1616
true :
1717
undefined;
18-
const channels = (await this.youtubeDataApi.listChannels({
18+
const { data: channels } = await this.youtubeDataApi.listChannels({
1919
id,
2020
mine,
2121
managedByMe,
2222
part,
2323
onBehalfOfContentOwner,
2424
maxResults,
2525
hl,
26-
})).data;
27-
$.export("$summary", `Successfully fetched ${channels.items.length} channel(s)`);
26+
});
27+
$.export("$summary", `Successfully fetched ${channels.items.length} channel${channels.items.length === 1
28+
? ""
29+
: "s"}`);
2830
return channels;
2931
},
3032
};

components/youtube_data_api/actions/create-comment-thread/create-comment-thread.mjs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ export default {
55
...common,
66
key: "youtube_data_api-create-comment-thread",
77
name: "Create Comment Thread",
8-
description: "Creates a new top-level comment in a video. [See the docs](https://developers.google.com/youtube/v3/docs/commentThreads/insert) for more information",
9-
version: "0.0.1",
8+
description: "Creates a new top-level comment in a video. [See the documentation](https://developers.google.com/youtube/v3/docs/commentThreads/insert) for more information",
9+
version: "0.0.2",
1010
type: "action",
1111
props: {
1212
youtubeDataApi,
@@ -21,7 +21,7 @@ export default {
2121
youtubeDataApi,
2222
"userOwnedVideo",
2323
],
24-
description: "Select the video to add comment to. Leave blank to post comment to channel.",
24+
description: "Select the video to add comment to. E.g. `wslno0wDSFQ`. Leave blank to post comment to channel.",
2525
},
2626
text: {
2727
type: "string",

components/youtube_data_api/actions/create-playlist/create-playlist.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ export default {
66
...common,
77
key: "youtube_data_api-create-playlist",
88
name: "Create Playlist",
9-
description: "Creates a playlist. [See the docs](https://developers.google.com/youtube/v3/docs/playlists/insert) for more information",
10-
version: "0.0.2",
9+
description: "Creates a playlist. [See the documentation](https://developers.google.com/youtube/v3/docs/playlists/insert) for more information",
10+
version: "0.0.3",
1111
type: "action",
1212
props: {
1313
youtubeDataApi,

components/youtube_data_api/actions/delete-playlist-items/common.mjs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@ export default {
44
onBehalfOfContentOwner: this.onBehalfOfContentOwner,
55
};
66
const youtube = await this.youtubeDataApi.youtube();
7-
const responses = [];
87
for (const videoId of this.videoIds) {
98
params.id = videoId;
10-
const { data } = await youtube.playlistItems.delete(params);
11-
responses.push(data);
9+
await youtube.playlistItems.delete(params);
1210
}
13-
$.export("$summary", `Successfully deleted ${this.videoIds.length} item(s) from playlist with ID ${this.playlistId}`);
11+
$.export("$summary", `Successfully deleted ${this.videoIds.length} item${this.videoIds.length === 1
12+
? ""
13+
: "s"} from playlist with ID ${this.playlistId}`);
1414
// nothing to return
1515
},
1616
};

components/youtube_data_api/actions/delete-playlist-items/delete-playlist-items.mjs

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ export default {
55
...common,
66
key: "youtube_data_api-delete-playlist-items",
77
name: "Delete Playlist Items",
8-
description: "Deletes a playlist item. [See the docs](https://developers.google.com/youtube/v3/docs/playlistItems/delete) for more information",
9-
version: "0.0.1",
8+
description: "Deletes a playlist item. [See the documentation](https://developers.google.com/youtube/v3/docs/playlistItems/delete) for more information",
9+
version: "0.0.2",
1010
type: "action",
1111
props: {
1212
youtubeDataApi,
@@ -17,19 +17,13 @@ export default {
1717
],
1818
},
1919
videoIds: {
20-
type: "string[]",
21-
label: "Video IDs",
22-
description: "Array of identifiers of the videos to be removed from the playlist",
23-
async options() {
24-
const { data } = await this.youtubeDataApi.getPlaylistItems({
25-
part: "contentDetails,id,snippet,status",
26-
playlistId: this.playlistId,
27-
});
28-
return data?.items?.map((item) => ({
29-
label: item.snippet.title,
30-
value: item.id,
31-
})) || [];
32-
},
20+
propDefinition: [
21+
youtubeDataApi,
22+
"playlistItemIds",
23+
(c) => ({
24+
playlistId: c.playlistId,
25+
}),
26+
],
3327
},
3428
onBehalfOfContentOwner: {
3529
propDefinition: [

components/youtube_data_api/actions/delete-playlist/delete-playlist.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ export default {
55
...common,
66
key: "youtube_data_api-delete-playlist",
77
name: "Delete Playlist",
8-
description: "Deletes a playlist. [See the docs](https://developers.google.com/youtube/v3/docs/playlists/delete) for more information",
9-
version: "0.0.1",
8+
description: "Deletes a playlist. [See the documentation](https://developers.google.com/youtube/v3/docs/playlists/delete) for more information",
9+
version: "0.0.2",
1010
type: "action",
1111
props: {
1212
youtubeDataApi,

components/youtube_data_api/actions/list-activities/common.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ export default {
1313
const mine = this.useCase === "mine" ?
1414
true :
1515
undefined;
16-
const activities = (await this.youtubeDataApi.listActivities({
16+
const { data: activities } = await this.youtubeDataApi.listActivities({
1717
channelId,
1818
mine,
1919
part,
2020
regionCode,
2121
maxResults,
2222
publishedBefore,
2323
publishedAfter,
24-
})).data;
24+
});
2525
$.export("$summary", `Successfully fetched ${activities.items.length} ${activities.items.length === 1
2626
? "activity"
2727
: "activities"}`);

components/youtube_data_api/actions/list-activities/list-activities.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ export default {
66
...common,
77
key: "youtube_data_api-list-activities",
88
name: "List Activities",
9-
description: "Returns a list of channel activity events that match the request criteria. [See the docs](https://developers.google.com/youtube/v3/docs/channels/list) for more information",
10-
version: "0.0.3",
9+
description: "Returns a list of channel activity events that match the request criteria. [See the documentation](https://developers.google.com/youtube/v3/docs/activities/list) for more information",
10+
version: "0.0.4",
1111
type: "action",
1212
props: {
1313
youtubeDataApi,

0 commit comments

Comments
 (0)