Packages › trotsky › StepStarterPacks
StepStarterPacks class
Abstract class representing a list of starter packs to process.
Signature:
export declare class StepStarterPacks<P = StepBuilder, C = null, O extends StepStarterPacksOutput = StepStarterPacksOutput> extends StepBuilderList<P, C, O>Extends: StepBuilderList<P, C, O>
Example 1
Get multiple starter packs by their URIs:
const packUris = [
"at://did:plc:example1/app.bsky.graph.starterpack/pack1",
"at://did:plc:example2/app.bsky.graph.starterpack/pack2"
]
await Trotsky.init(agent)
.starterPacks(packUris)
.tap((step) => {
step.context.forEach(pack => {
console.log(`${pack.creator.handle}: ${pack.listItemCount} members`)
})
})
.run()Example 2
Iterate through multiple starter packs:
await Trotsky.init(agent)
.starterPacks([uri1, uri2, uri3])
.each()
.tap((step) => {
const pack = step.context
console.log(`Pack by @${pack.creator.handle}`)
console.log(`Joined: ${pack.joinedAllTimeCount || 0}`)
})
.run()Constructors
Constructor | Modifiers | Description |
|---|---|---|
Initializes the StepStarterPacks instance with the given agent, parent, and URIs. |
Properties
Property | Modifiers | Type | Description |
|---|---|---|---|
StepStarterPacksEntry<this>[] | Holds the list of steps to be executed for each starter pack entry. | ||
Resolvable<StepStarterPacksUris> | The URIs of the starter packs to retrieve, which can be resolved dynamically at runtime. |
Methods
Method | Modifiers | Description |
|---|---|---|
Applies the step by resolving the URIs parameter and fetching the starter packs. Sets the starter packs data as the output of this step. | ||
Clones the current step and returns a new instance with the same parameters. | ||
Appends a new starter pack entry step to the current list and returns it. |