bannerAction method
Implementation
Future<void> bannerAction(BannerResponse banner, {String? action}) async {
final storage = HiveStorageService.instance;
Map<String, dynamic> body = {
'deviceId': await storage.getDeviceId(),
'profileId': await storage.getProfileId(),
'sessionId': await SessionService.instance.getSessionId(),
'action': action,
'attributions': {
'bannerBlockId': banner.token,
'bannerId': banner.bannerId.toString(),
},
};
final response = await http.post(
Uri.parse('${_getEndpoint()}/api/v0/push/events'),
headers: {
'content-type': 'application/json',
'authorization': 'Bearer $_accessToken',
},
body: jsonEncode(body),
);
if (response.statusCode != 202) {
throw Exception(
'Banner Event $action API error: ${response.statusCode} - ${response.body}',
);
}
}