getClientById method

Future<Response> getClientById({
  1. dynamic accessToken,
  2. dynamic clientId,
})

Implementation

Future<Response> getClientById({accessToken, clientId}) async {
  Map<String, String> headers = {'Authorization': 'Bearer $accessToken'};
  String path = "clientId=$clientId";
  var response = await networking.getData(
      path: 'get_client_by_id?$path', headers: headers);

  if (response.isSuccess && response.data != null) {
    GetClientResponse getClientResponse =
        GetClientResponse.fromJson(response.data);

    return Response(true, data: getClientResponse.client, message: '');
  } else if (response.message.contains('No records')) {
    return Response(false, message: 'No records');
  }

  return Response(false, message: response.message);
}