toggleEnable method
Toggles the enabled state of a campaign.
id is the ID of the campaign to toggle.
Returns the updated CampaignModel instance.
Implementation
Future<ApiResponseModel<CampaignModel?>> toggleEnable({
required String id,
}) async {
final url = "$_baseUrl/campaign/$id/toggle-enable";
final payload = {
'id': id,
};
debugPrint("flutter_mon_sms_pro/campaign/toggle/payload: $payload");
final r = await _dio.post(url, data: {
...payload,
"apiKey": _apiKey,
});
debugPrint("flutter_mon_sms_pro/campaign/toggle/data: ${r.data}");
final response = ApiResponseModel.fromJson(
r.data, (data) => CampaignModel.fromJson(data as Map<String, dynamic>));
return response;
}