saveClient method
Future<Response>
saveClient({
- dynamic accessToken,
- dynamic createdById,
- dynamic clientId,
- dynamic name,
- List<
ClientAttribute> ? attribute,
Implementation
Future<Response> saveClient(
{accessToken,
createdById,
clientId,
name,
List<ClientAttribute>? attribute}) async {
Client client = Client(
createdById: createdById,
clientId: clientId,
name: name,
attribute: attribute ?? []);
String body = jsonEncode(client);
String api = 'save_client';
Map<String, String> headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer $accessToken'
};
var response =
await networking.postData(api: api, body: body, headers: headers);
if (response.isSuccess) {
return Response(true, message: '', data: response.data);
} else if (response.message.contains('No records')) {
return Response(false, message: 'No records');
}
return Response(false, message: response.message);
}