getMonthlyDealsProducts method
Gets all products that are on monthly sale.
Implementation
Future<PrintifyWeeklyDealsModel> getMonthlyDealsProducts({
required String baseUrl,
}) async {
Response? response;
try {
final dio = Dio(
BaseOptions(
contentType: 'application/json',
responseType: ResponseType.json,
baseUrl: 'https://$baseUrl/app',
),
);
response = await dio.get(
'/getWeeklyDeals',
);
if (response.statusCode == 200) {
return PrintifyWeeklyDealsModel.fromJson(response.data);
} else {
throw Exception(
'Non 200 code for getting products on monthly sale. Response: ${response.statusCode}');
}
} catch (e) {
throw Exception(
'Non 200 code for getting products on monthly sale. Response: ${response?.statusCode}');
}
}