Skip to content

Packages  ›  trotsky  ›  StepSearchActors

StepSearchActors class

Represents a step for searching actors on Bluesky, with support for pagination.

Signature:

typescript
export declare class StepSearchActors<P, C = null, O extends StepSearchActorsOutput = StepSearchActorsOutput> extends StepActors<P, C, O>

Extends: StepActors<P, C, O>

Example 1

Search for actors and display them:

ts
await Trotsky.init(agent)
  .searchActors({ q: "typescript" })
  .take(10)
  .each()
  .tap((step) => {
    console.log(step.context.handle)
    console.log(`Followers: ${step.context.followersCount}`)
  })
  .run()

Example 2

Follow actors matching specific criteria:

ts
await Trotsky.init(agent)
  .searchActors({ q: "bluesky" })
  .take(20)
  .each()
  .when((step) => step?.context?.followersCount > 100)
  .follow()
  .wait(2000)
  .run()

Constructors

Constructor

Modifiers

Description

(constructor)(agent, parent, queryParams)

Initializes the StepSearchActors instance with the given agent, parent, and query parameters.

Properties

Property

Modifiers

Type

Description

_queryParams

StepSearchActorsQueryParams

The initial query parameters for the search.

Methods

Method

Modifiers

Description

applyPagination()

Applies the pagination logic to retrieve actors based on the search parameters. Results are stored in the output property.

clone()

Clones the current step and returns a new instance with the same parameters.

queryParams(cursor)

Constructs the query parameters for the current pagination step.