updateOne method
Future<QuickbooksCustomer>
updateOne({
- required String accessToken,
- required String companyId,
- required QuickbooksCustomer data,
Updates a QuickbooksCustomer with
the given accessToken
and companyId
Implementation
Future<QuickbooksCustomer> updateOne({
required String accessToken,
required String companyId,
required QuickbooksCustomer data,
}) async {
var oldData = await get(
accessToken: accessToken,
companyId: companyId,
id: data.id!,
);
if (oldData == null) {
throw AlfredException(404, 'Data not found');
}
data.syncToken = oldData.syncToken;
var result = await post(
accessToken: accessToken,
companyId: companyId,
data: data.toMap(),
location: 'Customer',
);
var newData = QuickbooksCustomer.fromMap(result);
return newData;
}