Packages › trotsky › StepPostThread
StepPostThread class
Represents a step for retrieving a full post thread with replies using the Bluesky API.
Signature:
typescript
export declare class StepPostThread<P = StepPost, C extends StepPostOutput = StepPostOutput, O extends StepPostThreadOutput = StepPostThreadOutput> extends Step<P, C, O>Extends: Step<P, C, O>
Example 1
Get a post thread with replies:
ts
await Trotsky.init(agent)
.post("at://did:plc:example/app.bsky.feed.post/postid")
.thread()
.tap((step) => {
const thread = step.output.thread as AppBskyFeedDefs.ThreadViewPost
console.log(`Thread by: ${thread.post.author.handle}`)
console.log(`Replies: ${thread.replies?.length || 0}`)
})
.run()Example 2
Get a thread with custom depth:
ts
await Trotsky.init(agent)
.post("at://did:plc:example/app.bsky.feed.post/postid")
.thread({ depth: 10, parentHeight: 5 })
.tap((step) => {
console.log(step.output)
})
.run()Constructors
Constructor | Modifiers | Description |
|---|---|---|
Initializes the StepPostThread instance. |
Properties
Property | Modifiers | Type | Description |
|---|---|---|---|
Partial<StepPostThreadQueryParams> | Additional query parameters for the thread request (depth, parentHeight). |
Methods
Method | Modifiers | Description |
|---|---|---|
Applies the step logic to retrieve the thread. | ||
Clones the current step and returns a new instance with the same parameters. |