getPromotions method

Future<void> getPromotions(
  1. PromotionsApiQuery promotionsApiQuery, {
  2. required void onSuccess(
    1. PromotionResponse
    ),
  3. required void onError(
    1. SyneriseError error
    ),
})

This method retrieves promotions that match the parameters defined in an API query.

Args: promotionsApiQuery (PromotionsApiQuery): It is an object of type PromotionsApiQuery which contains the query parameters for the promotions API.

Implementation

Future<void> getPromotions(PromotionsApiQuery promotionsApiQuery,
    {required void Function(PromotionResponse) onSuccess,
    required void Function(SyneriseError error) onError}) async {
  SyneriseResult<PromotionResponse> result =
      await _methods.getPromotions(promotionsApiQuery);

  result.onSuccess((result) {
    onSuccess(result);
  }).onError((error) {
    onError(error);
  });
}