StepFeed class
Represents a step for retrieving posts from a custom feed using the Bluesky API. Supports paginated retrieval of posts.
Signature:
typescript
export declare class StepFeed<P = Trotsky, C = null, O extends StepFeedOutput = StepFeedOutput> extends StepPosts<P, C, O>Extends: StepPosts<P, C, O>
Example 1
Get posts from a custom feed:
ts
await Trotsky.init(agent)
.feed("at://did:plc:z72i7hdynmk6r22z27h6tvur/app.bsky.feed.generator/whats-hot")
.take(20)
.each()
.tap((step) => {
console.log(`@${step.context.author.handle}: ${step.context.record.text}`)
})
.run()Example 2
Like posts from a feed with specific criteria:
ts
await Trotsky.init(agent)
.feed("at://did:plc:example/app.bsky.feed.generator/typescript")
.take(50)
.each()
.when((step) => step?.context?.likeCount > 10)
.like()
.wait(1000)
.run()Constructors
Constructor | Modifiers | Description |
|---|---|---|
Initializes the StepFeed instance with the given agent, parent, and feed URI. |
Properties
Property | Modifiers | Type | Description |
|---|---|---|---|
The URI of the custom feed. |
Methods
Method | Modifiers | Description |
|---|---|---|
Applies pagination to retrieve feed posts and sets the output. Fetches paginated results using the agent and appends them to the output. | ||
Clones the current step and returns a new instance with the same parameters. | ||
Generates query parameters for retrieving the feed, including the optional cursor. |