pushInteractionEvent function

Future pushInteractionEvent(
  1. dynamic instanceId,
  2. dynamic type
)

Implementation

Future<dynamic> pushInteractionEvent(instanceId, type) async {
  var dio = ApiService().createDio();

  final apiKey = await getApiKey();
  final user = await getUser();
  final userId = user['userId'];
  final dataCenterPushUrl = await getDataCenterPushUrl();
  final deviceInformation = await getDeviceInformation();
  final deviceType = deviceInformation['deviceType'];

  Map<String, dynamic> data = {
    'instanceId': instanceId,
    'type': type,
    'os': deviceType,
    'userId': userId,
  };

  final jsonData = convert.jsonEncode(data);

  final response = await dio.post(
      '$dataCenterPushUrl$pushNotificationInteractionUrl?apiKey=$apiKey',
      data: jsonData);

  return response.data;
}