Module: Tempest::Follows

Defined in:
lib/tempest/follows.rb

Overview

Fetches the authenticated user’s follow list via app.bsky.graph.getFollows. Returns a flat array of ‘handle:` so callers can both warm the HandleResolver and build a Jetstream `wantedDids` filter from a single pass.

Constant Summary collapse

PAGE_LIMIT =
100

Class Method Summary collapse

Class Method Details

.fetch(client, actor:) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/tempest/follows.rb', line 13

def fetch(client, actor:)
  results = []
  cursor = nil

  loop do
    response = client.get(
      "app.bsky.graph.getFollows",
      query: { actor: actor, limit: PAGE_LIMIT, cursor: cursor },
    )

    Array(response["follows"]).each do |row|
      did = row["did"]
      handle = row["handle"]
      results << { did: did, handle: handle } if did
    end

    cursor = response["cursor"]
    break if cursor.nil? || cursor.empty?
  end

  results
end