getContent static method

Future<ContentModel> getContent(
  1. String listtype, {
  2. String genre = "",
  3. String language = "",
  4. String objecttype = "",
  5. String subcategory = "",
  6. String tags = "",
  7. String category = "",
  8. String displaylanguage = "",
  9. String partnerid = "",
  10. int pagesize = 10,
  11. int page = 0,
})

Implementation

static Future<ContentModel> getContent(
  String listtype, {
  String genre = "",
  String language = "",
  String objecttype = "",
  String subcategory = "",
  String tags = "",
  String category = "",
  String displaylanguage = "",
  String partnerid = "",
  int pagesize = 10,
  int page = 0,
}) async {
  String url =
      "${AppUrls.baseUrlVCMS}/subscriber/v1/content?&orderby={%22updatedon%22%3A%22DSC%22%2C}&pagesize=$pagesize&page=$page";
  if (genre.isNotEmpty) {
    url =
        "$url&genre=$genre&subgenre=$genre&groupbyor=[%22genre%22%2C%22subgenre%22]";
  }
  if (partnerid.isNotEmpty) {
    url = "$url&partnerid=$partnerid";
  }
  if (listtype.isNotEmpty) {
    url = "$url&listtype=$listtype";
  }
  if (objecttype.isNotEmpty) {
    url = "$url&objecttype=$objecttype";
  }
  if (category.isNotEmpty) {
    url = "$url&category=$category";
  }

  if (subcategory.isNotEmpty) {
    url = "$url&subcategory=$subcategory";
  }
  if (tags.isNotEmpty) {
    url = "$url&tags=$tags";
  }
  if (displaylanguage.isNotEmpty) {
    url = "$url&displaylanguage=$displaylanguage";
  }
  if (language.isNotEmpty) {
    url = "$url&language=$language";
  }
  bool isSafari = await PlayService().isMpegtspackage();
  if (isSafari) {
    url = "$url&mpegtspackage=YES";
  }
  final response = await _dio!.get(url);
  ContentModel contentModel;
  if (response.data['errorcode'] == 7109) {
    contentModel = ContentModel(totalcount: 0, data: []);
  } else {
    contentModel = ContentModel.fromMap(response.data);
  }
  return contentModel;
}