Packages › trotsky › StepTimeline
StepTimeline class
Represents a step for retrieving the authenticated user's timeline using the Bluesky API. Supports paginated retrieval of posts from followed accounts.
Signature:
export declare class StepTimeline<P, C = null, O extends StepTimelineOutput = StepTimelineOutput> extends StepPosts<P, C, O>Extends: StepPosts<P, C, O>
Example 1
Get recent posts from your timeline:
await Trotsky.init(agent)
.timeline()
.take(20)
.each()
.tap((step) => {
console.log(`@${step.context.author.handle}: ${step.context.record.text}`)
})
.run()Example 2
Like posts from your timeline with specific criteria:
await Trotsky.init(agent)
.timeline()
.take(50)
.each()
.when((step) => step?.context?.record?.text?.includes("#typescript"))
.like()
.wait(1000)
.run()Example 3
Use a custom algorithm for timeline:
await Trotsky.init(agent)
.timeline({ algorithm: "reverse-chronological" })
.take(10)
.each()
.run()Constructors
Constructor | Modifiers | Description |
|---|---|---|
Initializes the StepTimeline instance with the given agent, parent, and optional query parameters. |
Properties
Property | Modifiers | Type | Description |
|---|---|---|---|
Query parameters for the timeline request. |
Methods
Method | Modifiers | Description |
|---|---|---|
Applies pagination to retrieve timeline 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 timeline, including the optional cursor. |