shippingAddresses method

Future<UserShippingAddresses> shippingAddresses({
  1. int? addressId,
  2. DateTime? fromUpdatedAt,
  3. int? pageSize,
})

KO: 배송지 가져오기
addressId에 배송지 ID 전달
fromUpdatedAt에 이전 페이지의 마지막 배송지 수정 시각 전달, 0 전달 시 처음부터 조회
pageSize에 한 페이지에 포함할 배송지 수 전달(기본값: 10)

EN: Retrieve shipping address
Pass the Shipping address ID to addressId
Pass the last shipping address modification on the previous page to fromUpdatedAt, retrieve from beginning if passing `0'
Pass the number of shipping addresses displayed on a page to pageSize(Default: 10)

Implementation

Future<UserShippingAddresses> shippingAddresses({
  int? addressId,
  DateTime? fromUpdatedAt,
  int? pageSize,
}) async {
  Map<String, dynamic> params = {
    Constants.addressId: addressId,
    Constants.fromUpdatedAt: fromUpdatedAt == null
        ? null
        : fromUpdatedAt.millisecondsSinceEpoch / 1000,
    Constants.pageSize: pageSize,
  };
  params.removeWhere((k, v) => v == null);
  return ApiFactory.handleApiError(() async {
    Response response = await _dio.get(Constants.v1ShippingAddressesPath,
        queryParameters: params);
    return UserShippingAddresses.fromJson(response.data);
  });
}