follows module reads a user’s follow graph — the users they follow and the users following them — and removes follow relationships by ID.
Every function acts on behalf of a named user. Pass that user’s Sublay ID as
actingUserId, the user your service key acts as. The returned graph and counts are from that user’s perspective.fetchFollowing
Returns a paginated list of the follow records for users the given user follows.Results per page: a whole number from
1 to 100. Defaults to 20. A larger value is rejected with 400 follow/invalid-query, never lowered to 100.Optional search term. Filters the list to users whose username or name contains this text (case-insensitive). When omitted, no filtering is applied.
Restricts which field
query matches against — username or name. When omitted, query matches either field.Promise<PaginatedResponse<FollowRow>>, where each FollowRow is { id, user, createdAt }: id is the follow record’s ID (what deleteFollow takes) and user is the followed user.
fetchFollowers
Returns a paginated list of the follow records for users that follow the given user.Results per page: a whole number from
1 to 100. Defaults to 20. A larger value is rejected with 400 follow/invalid-query, never lowered to 100.Optional search term. Filters the list to users whose username or name contains this text (case-insensitive). When omitted, no filtering is applied.
Restricts which field
query matches against — username or name. When omitted, query matches either field.Promise<PaginatedResponse<FollowRow>>, where each FollowRow is { id, user, createdAt } and user is the follower.
fetchFollowingCount
Returns the number of users the given user follows.Promise<{ count: number }>
fetchFollowersCount
Returns the number of users following the given user.Promise<{ count: number }>
deleteFollow
Deletes a follow relationship by its follow record ID.The user the service key acts as, on whose behalf the follow is removed (must be the follower).
Promise<void>
