createDownload method
Implementation
Future<DownloadResponse> createDownload({
required String name,
required String url,
required String httpMethod,
required String moduleName,
required String payload,
}) async {
try {
final finalPayload = {
'FCMToken': SharedAppConfig.fcmToken,
'HttpMethod': httpMethod,
'ApiName': apiClient.currentBaseUrl + url,
'Payload': payload,
'ReportName': name,
'ModuleName': moduleName,
};
final response = await apiService.postData(
AppUrls.addDownloadDocument,
data: finalPayload,
);
return DownloadResponse(
success: response.statusCode == 200,
statusCode: response.statusCode ?? 0,
message: response.data?['message'] ?? '',
);
} catch (e) {
return DownloadResponse(
success: false,
statusCode: 500,
message: e.toString(),
);
}
}