> ## 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 Connection Status

> Read follow status and follow counts for the current user or another user.

Use follow info APIs to render profile headers, follow buttons, follower counts, following counts, and pending-request badges.

The current user's follow info returns counts only. Another user's follow info returns counts plus the current user's relationship status toward that user.

| Field                          | TypeScript       | iOS              | Android                    | Flutter               |
| ------------------------------ | ---------------- | ---------------- | -------------------------- | --------------------- |
| Follower count                 | `followerCount`  | `followersCount` | `getFollowerCount()`       | `followerCount`       |
| Following count                | `followingCount` | `followingCount` | `getFollowingCount()`      | `followingCount`      |
| Pending count for current user | `pendingCount`   | `pendingCount`   | `getPendingRequestCount()` | `pendingRequestCount` |
| Status for another user        | `status`         | `status`         | `getStatus()`              | `status`              |

## Parameters

| Operation                      | Parameter                          | Required           | Description                                                                                                       |
| ------------------------------ | ---------------------------------- | ------------------ | ----------------------------------------------------------------------------------------------------------------- |
| Get my follow info             | None                               | No                 | Reads the current user's follow counts and pending-request count.                                                 |
| Get another user's follow info | `userId` / `targetUserId`          | Yes                | ID of the user whose counts and relationship status should be read.                                               |
| Live observation               | Callback / observer / subscription | Platform-dependent | TypeScript, iOS, and Android examples observe live data. Retain and dispose the returned handle where applicable. |

## Get My Follow Info

Read the current user's follow counts and pending-request count for profile or account surfaces.

<CodeGroup>
  ```swift iOS theme={null}
  let relationship = AmityUserRelationship()

  _ = relationship.getMyFollowInfo().observe { liveObject, error in
      if let error {
          handleError(error)
          return
      }

      if let info = liveObject.snapshot {
          _ = info.followersCount
          _ = info.followingCount
          _ = info.pendingCount
      }
  }
  ```

  ```kotlin Android theme={null}
  val disposable = AmityCoreClient.newUserRepository()
      .relationship()
      .getMyFollowInfo()
      .subscribe(
          { info: AmityMyFollowInfo ->
              showSuccessMessage(info.getFollowerCount())
          },
          { error ->
              handleGeneralError(error)
          },
      )
  ```

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

  const unsubscribe = UserRepository.Relationship.getMyFollowInfo(
    ({ data: followInfo, loading, error }) => {
      if (error) {
        handleError(error);
        return;
      }

      if (!loading && followInfo) {
        updateUI({
          followers: followInfo.followerCount,
          following: followInfo.followingCount,
          pending: followInfo.pendingCount,
        });
      }
    },
  );
  ```

  ```dart Flutter theme={null}
  final info = await AmityCoreClient.newUserRepository()
      .relationship()
      .getMyFollowInfo();

  final followerCount = info.followerCount;
  final followingCount = info.followingCount;
  final pendingCount = info.pendingRequestCount;
  ```
</CodeGroup>

## Get Another User's Follow Info

Read another user's follow info when rendering a profile header or follow button state.

<CodeGroup>
  ```swift iOS theme={null}
  let relationship = AmityUserRelationship()

  _ = relationship.getFollowInfo(withUserId: "target-user-id").observe { liveObject, error in
      if let error {
          handleError(error)
          return
      }

      if let info = liveObject.snapshot {
          _ = info.status
          _ = info.followersCount
          _ = info.followingCount
      }
  }
  ```

  ```kotlin Android theme={null}
  val disposable = AmityCoreClient.newUserRepository()
      .relationship()
      .getFollowInfo(userId = targetUserId)
      .subscribe(
          { info: AmityUserFollowInfo ->
              showSuccessMessage(info.getStatus().apiKey)
          },
          { error ->
              handleGeneralError(error)
          },
      )
  ```

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

  const unsubscribe = UserRepository.Relationship.getFollowInfo(
    userId,
    ({ data: followInfo, loading, error }) => {
      if (error) {
        handleError(error);
        return;
      }

      if (!loading && followInfo) {
        updateUI({
          status: followInfo.status,
          followers: followInfo.followerCount,
          following: followInfo.followingCount,
        });
      }
    },
  );
  ```

  ```dart Flutter theme={null}
  final info = await AmityCoreClient.newUserRepository()
      .relationship()
      .getFollowInfo(targetUserId);

  final status = info.status;
  final followerCount = info.followerCount;
  final followingCount = info.followingCount;
  ```
</CodeGroup>

## Related Topics

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

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

  <Card title="Follower Lists" href="./get-follower-following-list" icon="list">
    Query follower and following lists.
  </Card>
</CardGroup>
