IsFollowing checks if "user" is following "target". Passing the empty string for "user" will check if the authenticated user is following "target". GitHub API docs: https://docs.github.com/rest/users/followers?apiVersion=2022-11-28#check-if-a-person-is-followed-by-the-authenticated-user GitHub API
(ctx context.Context, user, target string)
| 90 | //meta:operation GET /user/following/{username} |
| 91 | //meta:operation GET /users/{username}/following/{target_user} |
| 92 | func (s *UsersService) IsFollowing(ctx context.Context, user, target string) (bool, *Response, error) { |
| 93 | var u string |
| 94 | if user != "" { |
| 95 | u = fmt.Sprintf("users/%v/following/%v", user, target) |
| 96 | } else { |
| 97 | u = fmt.Sprintf("user/following/%v", target) |
| 98 | } |
| 99 | |
| 100 | req, err := s.client.NewRequest(ctx, "GET", u, nil) |
| 101 | if err != nil { |
| 102 | return false, nil, err |
| 103 | } |
| 104 | |
| 105 | resp, err := s.client.Do(req, nil) |
| 106 | following, err := parseBoolResponse(err) |
| 107 | return following, resp, err |
| 108 | } |
| 109 | |
| 110 | // Follow will cause the authenticated user to follow the specified user. |
| 111 | // |