updateHomeownerConsentApi function
Update the homeowner consent details of a device
Implementation
Future<void> updateHomeownerConsentApi({
required BuildContext context,
required int deviceId,
required List<Point>? signaturePoints,
required bool sendHomeownerEmail,
required String homeownerEmail,
}) async {
final api = await context.read(energyManagementV3ApiProvider.future);
final fileValue =
await SignatureController(points: signaturePoints).toPngBytes();
final response = await api.kemApiV3DevicesIdSignaturesPostFixed(
id: deviceId,
file: fileValue != null
? FileReference(
value: fileValue,
contentType: 'image/png',
filename: 'signature.png',
)
: null,
email: homeownerEmail,
action: sendHomeownerEmail
? HomeownerConsentActionDTO.sendemail
: HomeownerConsentActionDTO.uploadsignature,
);
assertSuccessfulResponse(response);
}