friends method

Future<Friends> friends({
  1. int? offset,
  2. int? limit,
  3. FriendOrder? friendOrder,
  4. Order? order,
  5. FriendsContext? context,
})

KO: 카카오톡 친구 목록 조회
offset으로 친구 목록 시작 지점 변경
limit로 페이지당 결과 수 변경
friendOrder로 정렬 방식 변경
order로 정렬 방식 변경
context로 친구 목록 조회 설정

EN: Retrieve list of friends
Change the start point of the friend list with offset
Change the number of results in a page with limit
Change the method to sort the friend list with friendOrder
Change the sorting method with order
Set Context for retrieving friend list with context

Implementation

Future<Friends> friends({
  int? offset,
  int? limit,
  FriendOrder? friendOrder,
  Order? order,
  FriendsContext? context,
}) async {
  SdkLog.d(
    '[TalkApi.friends] started | offset=${context?.offset ?? offset} limit=${context?.limit ?? limit} friendOrder=${context?.friendOrder?.name ?? friendOrder?.name} order=${context?.order?.name ?? order?.name}',
  );
  final params = <String, Object>{
    Constants.offset: ?(context?.offset ?? offset),
    Constants.limit: ?(context?.limit ?? limit),
    Constants.friendOrder: ?(context?.friendOrder?.name ?? friendOrder?.name),
    Constants.order: ?(context?.order?.name ?? order?.name),
    Constants.secureResource: true.toString(),
  };
  final response = await _client.get(
    Constants.v1FriendsPath,
    queryParameters: params,
  );
  final result = Friends.fromJson(response.data);
  SdkLog.i(
    '[TalkApi.friends] completed | friendCount=${result.elements?.length ?? 0} afterUrl=${result.afterUrl}',
  );
  return result;
}