Packages › trotsky › StepSearchPosts
StepSearchPosts class
Represents a step for searching posts on Bluesky, with support for pagination.
Signature:
typescript
export declare class StepSearchPosts<P, C = null, O extends StepSearchPostsOutput = StepSearchPostsOutput> extends StepPosts<P, C, O>Extends: StepPosts<P, C, O>
Example 1
Search for posts and display them:
ts
await Trotsky.init(agent)
.searchPosts({ q: "typescript" })
.take(10)
.each()
.tap((step) => {
console.log(step.context.record.text)
console.log(`Likes: ${step.context.likeCount}`)
})
.run()Example 2
Like posts matching specific criteria:
ts
await Trotsky.init(agent)
.searchPosts({ q: "bluesky" })
.take(20)
.each()
.when((step) => step?.context?.likeCount > 5)
.like()
.wait(2000)
.run()Constructors
Constructor | Modifiers | Description |
|---|---|---|
Initializes the StepSearchPosts instance with the given agent, parent, and query parameters. |
Properties
Property | Modifiers | Type | Description |
|---|---|---|---|
The initial query parameters for the search. |
Methods
Method | Modifiers | Description |
|---|---|---|
Applies the pagination logic to retrieve posts based on the search parameters. Results are stored in the | ||
Clones the current step and returns a new instance with the same parameters. | ||
Constructs the query parameters for the current pagination step. |