removeFromCampaign method

Future<Response> removeFromCampaign(
  1. String campaignId,
  2. String contactId
)

Implementation

Future<http.Response> removeFromCampaign(
    String campaignId, String contactId) async {
  final url =
      '${mauticBaseUrl!}/api/campaigns/$campaignId/contact/$contactId/remove';
  final headers = getHeaders();

  final response = await httpClient.post(
    Uri.parse(url),
    headers: headers,
  );
  if (response.statusCode != 200) {
    throw Exception(
        'Failed to remove user from campaign: ${response.statusCode}');
  }

  return jsonDecode(response.body);
}