> ## Documentation Index
> Fetch the complete documentation index at: https://learn.social.plus/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Follower/Following List

> Query paginated follower and following lists with the social.plus SDKs.

Use follower and following list APIs when you need to show people lists, pending requests, or accepted relationships. Results are paginated or live depending on the platform.

| List      | Description                      |
| --------- | -------------------------------- |
| Followers | Users who follow the target user |
| Following | Users the target user follows    |

<Info>
  Status filters use `accepted`, `pending`, or `all` where the platform exposes them. TypeScript and Flutter support status filters on target-user follower/following builders. iOS and Android support status filters on the current user's follower/following builders; use their target-user builders when you need another user's accepted social graph without a status filter.
</Info>

## Parameters

| Operation     | Parameter                 | Required           | Description                                                                                                      |
| ------------- | ------------------------- | ------------------ | ---------------------------------------------------------------------------------------------------------------- |
| Get followers | `userId` / `targetUserId` | Platform-dependent | Target user whose followers should be queried. iOS and Android status-filter snippets use current-user builders. |
| Get following | `userId` / `targetUserId` | Platform-dependent | Target user whose following list should be queried. iOS status-filter snippet uses the current-user builder.     |
| Both lists    | `status` / status filter  | No                 | Relationship status filter such as accepted, pending, or all where exposed.                                      |
| Both lists    | `limit` / page size       | No                 | Page size for paginated follower or following lists.                                                             |

## Get Followers

Query followers when your UI needs a paginated people list for a user. The iOS and Android snippets use the current-user builders because those SDKs expose status filters there.

<CodeGroup>
  ```swift iOS theme={null}
  let relationship = AmityUserRelationship()
  let followers = relationship.getMyFollowers(with: .accepted)

  _ = followers.observe { collection, error in
      if let error {
          handleError(error)
          return
      }

      let relationships = collection.snapshots
      _ = relationships.first?.sourceUser
  }

  followers.nextPage()
  ```

  ```kotlin Android theme={null}
  val disposable = AmityCoreClient.newUserRepository()
      .relationship()
      .getMyFollowers()
      .status(AmityFollowStatusFilter.ACCEPTED)
      .build()
      .query()
      .subscribe(
          { pagingData: PagingData<AmityFollowRelationship> ->
              showSuccessMessage(pagingData)
          },
          { error ->
              handleGeneralError(error)
          },
      )
  ```

  ```typescript TypeScript theme={null}
  import { UserRepository } from '@amityco/ts-sdk';

  let loadMoreFollowers: (() => void) | undefined;

  const unsubscribe = UserRepository.Relationship.getFollowers(
    { userId, status: 'accepted' },
    ({ data: followers, onNextPage, hasNextPage, loading, error }) => {
      if (error) {
        handleError(error);
        return;
      }

      if (!loading && followers) {
        renderResults(followers);
      }

      loadMoreFollowers = hasNextPage ? onNextPage : undefined;
    },
  );
  ```

  ```dart Flutter theme={null}
  final page = await AmityCoreClient.newUserRepository()
      .relationship()
      .getFollowers(targetUserId)
      .status(AmityFollowStatusFilter.ACCEPTED)
      .getPagingData(limit: 20);

  final relationships = page.data;
  ```
</CodeGroup>

## Get Following

Query following relationships when your UI needs the users a profile follows. The iOS snippet uses the current-user builder to show status filtering; the Android snippet uses the target-user builder for another user's following list.

<CodeGroup>
  ```swift iOS theme={null}
  let relationship = AmityUserRelationship()
  let followings = relationship.getMyFollowings(with: .accepted)

  _ = followings.observe { collection, error in
      if let error {
          handleError(error)
          return
      }

      let relationships = collection.snapshots
      _ = relationships.first?.targetUser
  }

  followings.nextPage()
  ```

  ```kotlin Android theme={null}
  val disposable = AmityCoreClient.newUserRepository()
      .relationship()
      .getFollowings(userId = targetUserId)
      .build()
      .query()
      .subscribe(
          { pagingData: PagingData<AmityFollowRelationship> ->
              showSuccessMessage(pagingData)
          },
          { error ->
              handleGeneralError(error)
          },
      )
  ```

  ```typescript TypeScript theme={null}
  import { UserRepository } from '@amityco/ts-sdk';

  let loadMoreFollowings: (() => void) | undefined;

  const unsubscribe = UserRepository.Relationship.getFollowings(
    { userId, status: 'accepted' },
    ({ data: followings, onNextPage, hasNextPage, loading, error }) => {
      if (error) {
        handleError(error);
        return;
      }

      if (!loading && followings) {
        renderResults(followings);
      }

      loadMoreFollowings = hasNextPage ? onNextPage : undefined;
    },
  );
  ```

  ```dart Flutter theme={null}
  final page = await AmityCoreClient.newUserRepository()
      .relationship()
      .getFollowings(targetUserId)
      .status(AmityFollowStatusFilter.ACCEPTED)
      .getPagingData(limit: 20);

  final relationships = page.data;
  ```
</CodeGroup>

## Follow Relationship Fields

| Platform   | Common fields                                                                     |
| ---------- | --------------------------------------------------------------------------------- |
| TypeScript | `from`, `to`, `status`, `createdAt`, `updatedAt`                                  |
| iOS        | `sourceUserId`, `targetUserId`, `sourceUser`, `targetUser`, `status`              |
| Android    | `getSourceUser()`, `getTargetUser()`, `getStatus()`                               |
| Flutter    | `sourceUserId`, `targetUserId`, `sourceUser`, `targetUser`, `status`, `createdAt` |

## Related Topics

<CardGroup cols={3}>
  <Card title="Follow/Unfollow User" href="./follow-unfollow-user" icon="user-plus">
    Change a relationship.
  </Card>

  <Card title="Connection Status" href="./get-connection-status" icon="signal">
    Read counts and status.
  </Card>

  <Card title="Accept/Decline Requests" href="./accept-decline-follow-request" icon="handshake">
    Process pending followers.
  </Card>
</CardGroup>
