feat: Convert all app files to JS

This commit is contained in:
Faruk AYDIN
2024-01-05 17:44:21 +01:00
parent b95478b635
commit 43dba351c3
1030 changed files with 5114 additions and 6436 deletions

View File

@@ -1,4 +1,4 @@
import defineAction from '../../../../helpers/define-action';
import defineAction from '../../../../helpers/define-action.js';
export default defineAction({
name: 'Create tweet',
@@ -8,7 +8,7 @@ export default defineAction({
{
label: 'Tweet body',
key: 'tweet',
type: 'string' as const,
type: 'string',
required: true,
description: 'The content of your new tweet.',
variables: true,

View File

@@ -0,0 +1,4 @@
import createTweet from './create-tweet/index.js';
import searchUser from './search-user/index.js';
export default [createTweet, searchUser];

View File

@@ -1,4 +0,0 @@
import createTweet from './create-tweet';
import searchUser from './search-user';
export default [createTweet, searchUser];

View File

@@ -0,0 +1,35 @@
import defineAction from '../../../../helpers/define-action.js';
export default defineAction({
name: 'Search user',
key: 'searchUser',
description: 'Search a user on Twitter',
arguments: [
{
label: 'Username',
key: 'username',
type: 'string',
required: true,
description: 'The username of the Twitter user you want to search for',
variables: true,
},
],
async run($) {
const { data } = await $.http.get(
`/2/users/by/username/${$.step.parameters.username}`,
{
params: {
expansions: 'pinned_tweet_id',
'tweet.fields':
'attachments,author_id,context_annotations,conversation_id,created_at,edit_controls,entities,geo,id,in_reply_to_user_id,lang,non_public_metrics,public_metrics,organic_metrics,promoted_metrics,possibly_sensitive,referenced_tweets,reply_settings,source,text,withheld',
'user.fields':
'created_at,description,entities,id,location,name,pinned_tweet_id,profile_image_url,protected,public_metrics,url,username,verified,verified_type,withheld',
},
}
);
$.setActionItem({
raw: data.data,
});
},
});

View File

@@ -1,30 +0,0 @@
import defineAction from '../../../../helpers/define-action';
export default defineAction({
name: 'Search user',
key: 'searchUser',
description: 'Search a user on Twitter',
arguments: [
{
label: 'Username',
key: 'username',
type: 'string' as const,
required: true,
description: 'The username of the Twitter user you want to search for',
variables: true,
},
],
async run($) {
const { data } = await $.http.get(`/2/users/by/username/${$.step.parameters.username}`, {
params: {
expansions: 'pinned_tweet_id',
'tweet.fields': 'attachments,author_id,context_annotations,conversation_id,created_at,edit_controls,entities,geo,id,in_reply_to_user_id,lang,non_public_metrics,public_metrics,organic_metrics,promoted_metrics,possibly_sensitive,referenced_tweets,reply_settings,source,text,withheld',
'user.fields': 'created_at,description,entities,id,location,name,pinned_tweet_id,profile_image_url,protected,public_metrics,url,username,verified,verified_type,withheld'
}
});
$.setActionItem({
raw: data.data
});
},
});