Skip to content

Packages  ›  trotsky  ›  StepStarterPack

StepStarterPack class

Represents a step for retrieving a starter pack by its URI.

Signature:

typescript
export declare class StepStarterPack<P = StepBuilder, C = null, O extends StepStarterPackOutput = StepStarterPackOutput> extends Step<P, C, O>

Extends: Step<P, C, O>

Example 1

Get a specific starter pack:

ts
await Trotsky.init(agent)
  .starterPack("at://did:plc:example/app.bsky.graph.starterpack/packid")
  .tap((step) => {
    console.log(`Creator: ${step.context.creator.handle}`)
    console.log(`List: ${step.context.list?.name}`)
    console.log(`Joined this week: ${step.context.joinedWeekCount}`)
  })
  .run()

Example 2

Get starter pack details and display feeds:

ts
await Trotsky.init(agent)
  .starterPack("at://did:plc:example/app.bsky.graph.starterpack/packid")
  .tap((step) => {
    console.log(`Feeds in pack: ${step.context.feeds?.length || 0}`)
    step.context.feeds?.forEach(feed => {
      console.log(`- ${feed.displayName}`)
    })
  })
  .run()

Constructors

Constructor

Modifiers

Description

(constructor)(agent, parent, uri)

Initializes the StepStarterPack instance with the given agent, parent, and URI.

Methods

Method

Modifiers

Description

apply()

Applies the step logic to retrieve the starter pack and sets the output to the retrieved starter pack's data. If no starter pack is found, the output is set to null.

clone(rest)

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

queryParams()

Resolves the query parameters for retrieving the starter pack, including its URI.