Compare commits

..

1 Commits

Author SHA1 Message Date
Rıdvan Akca
84ecf105c2 feat(bluesky): add search post by url action 2024-05-28 10:05:09 +02:00
3 changed files with 39 additions and 1 deletions

View File

@@ -1,3 +1,4 @@
import createPost from './create-post/index.js';
import searchPostByUrl from './search-post-by-url/index.js';
export default [createPost];
export default [createPost, searchPostByUrl];

View File

@@ -0,0 +1,35 @@
import defineAction from '../../../../helpers/define-action.js';
export default defineAction({
name: 'Search post by url',
key: 'searchPostByUrl',
description: 'Searches a post in a thread by url.',
arguments: [
{
label: 'Post Url',
key: 'postUrl',
type: 'string',
required: true,
variables: true,
description: 'Enter whole post url here.',
},
],
async run($) {
const postUrl = $.step.parameters.postUrl;
const urlParts = postUrl.split('/');
const handle = urlParts[urlParts.length - 3];
const postId = urlParts[urlParts.length - 1];
const uri = `at://${handle}/app.bsky.feed.post/${postId}`;
const params = {
uri,
};
const { data } = await $.http.get('/app.bsky.feed.getPostThread', {
params,
});
$.setActionItem({ raw: data });
},
});

View File

@@ -3,6 +3,8 @@ favicon: /favicons/bluesky.svg
items:
- name: Create post
desc: Creates a new post.
- name: Search post by url
desc: Searches a post in a thread by url.
---
<script setup>