Package 

Class AdFetcherSDK


  • 
    public final class AdFetcherSDK
    
                        

    Created by adeshmukh on 07/02/25. Project Name: OSMOS-Android-SDK File Name: AdFetcherSDK

    This class is responsible for making API calls to fetch different types of ads using defined function signature for display ads with au and display ads with pt.

    • Constructor Detail

      • AdFetcherSDK

        AdFetcherSDK()
    • Method Detail

      • fetchDisplayAdsWithAu

         final Map<String, Object> fetchDisplayAdsWithAu(String cliUbid, String pageType, Integer productCount, List<String> adUnits, Map<String, Object> targetingParams, Map<String, Object> extraParams)

        Fetches display ads using Ad Unit-based targeting.

        Parameters:
        cliUbid - Unique client identifier
        pageType - Type of page requesting ads
        productCount - Number of products to display ads for
        adUnits - List of ad unit identifiers
        targetingParams - Optional: Targeting parameters for ad filtering
        extraParams - Optional: Additional parameters if required
      • fetchDisplayAdsWithPt

         final Map<String, Object> fetchDisplayAdsWithPt(String cliUbid, String pageType, Integer productCount, Map<String, Object> targetingParams, Map<String, Object> extraParams)

        Fetches display ads using Page Type-based targeting.

        Parameters:
        cliUbid - Unique client identifier
        pageType - Type of page requesting ads
        productCount - Number of products to display ads for
        targetingParams - Optional : Targeting parameters for ad filtering
        extraParams - Optional: Additional parameters if required
      • fetchPlaAds

         final Map<String, Object> fetchPlaAds(String cliUbid, String pageName, String pageType, Integer productCount, Map<String, Object> filters, Map<String, Object> extraParams)

        Fetches Product Listing Ads (PLA) based on the provided parameters. Generic function for PLA Ads

        Parameters:
        cliUbid - Unique identifier for the client.
        pageName - Optional name of the page requesting ads.
        pageType - Type of the page (e.g., "SEARCH", "HOME").
        productCount - Number of products to display ads for.
        filters - Optional: Map containing filter criteria; values can be of any type for flexibility.
        extraParams - Optional: Additional parameters for the request; defaults to an empty map.
      • fetchPlaSearchPageAds

         final Map<String, Object> fetchPlaSearchPageAds(String cliUbid, String pageName, Integer productCount, List<Object> keywords, Map<String, Object> filters, Map<String, Object> extraParams)

        Fetches PLA ads specifically for search pages.

        Parameters:
        cliUbid - Unique identifier for the client.
        pageName - Optional: Name of the search results page.
        productCount - Number of products to display ads for.
        keywords - List of search keywords.
        filters - Optional: Map containing filter criteria as key-value pairs.
        extraParams - Optional: Additional parameters for the request.
      • fetchPlaHomePageAds

         final Map<String, Object> fetchPlaHomePageAds(String cliUbid, String pageName, Integer productCount, Map<String, Object> filters, Map<String, Object> extraParams)

        Fetches Product Listing Ads (PLA) for the home page.

        Parameters:
        cliUbid - Unique identifier for the client.
        pageName - Name of the home page requesting ads.
        productCount - Number of products to display ads for.
        filters - Optional: Map containing filter criteria; values can be of any type for flexibility.
        extraParams - Optional: Additional parameters for the request; defaults to an empty map.
      • fetchPlaCategoryPageAds

         final Map<String, Object> fetchPlaCategoryPageAds(String cliUbid, String pageName, Integer productCount, List<Object> categories, Map<String, Object> filters, Map<String, Object> extraParams)

        Fetches PLA ads for a category page.

        Parameters:
        cliUbid - Unique identifier for the client.
        pageName - Optional: Name of the category page requesting ads.
        productCount - Number of products to display ads for.
        categories - List of categories to filter ads.
        filters - Optional: Map containing filter criteria as key-value pairs.
        extraParams - Optional: Additional parameters for the request; defaults to an empty map.
      • fetchPlaProductPageAds

         final Map<String, Object> fetchPlaProductPageAds(String cliUbid, String pageName, Integer productCount, List<Object> skuIds, Map<String, Object> filters, Map<String, Object> extraParams)

        Fetches PLA ads for a product detail page.

        Parameters:
        cliUbid - Unique identifier for the client.
        pageName - Optional: Name of the product page requesting ads.
        productCount - Number of products to display ads for.
        skuIds - List of SKU identifiers for the products.
        filters - Optional: Map containing filter criteria as key-value pairs.
        extraParams - Optional: Additional parameters for the request.
      • fetchPlaPurchasePageAds

         final Map<String, Object> fetchPlaPurchasePageAds(String cliUbid, String pageName, Integer productCount, List<Object> skuIds, Map<String, Object> filters, Map<String, Object> extraParams)

        Fetches PLA ads for a purchase detail page.

        Parameters:
        cliUbid - Unique identifier for the client.
        pageName - Optional: Name of the product page requesting ads.
        productCount - Number of products to display ads for.
        skuIds - List of SKU identifiers for the products.
        filters - Optional: Map containing filter criteria as key-value pairs.
        extraParams - Optional: Additional parameters for the request.
      • fetchTpaPageAds

         final Map<String, Object> fetchTpaPageAds(String cliUbid, String pageName, Integer productCount, List<Object> skuIds, Map<String, Object> filters, Map<String, Object> extraParams)

        POST API Call for Tagged Product Ads.

        This function constructs a JSON payload with the provided parameters and sends a POST request to the configured Tagged product ads. The response is logged for debugging purposes.

        Parameters:
        cliUbid - Unique identifier for the client session.
        pageName - Optional: Name of the page requesting ads.
        productCount - Number of products to display ads for.
        skuIds - List of SKU identifiers related to the products.
        filters - Optional: Map containing filter criteria; values can be of any type for flexibility.
        extraParams - Optional: Additional parameters for the request; values can be of any type.
      • fetch_display_ads_with_au

        @Deprecated(message = Use fetchDisplayAdsWithAu instead, replaceWith = @ReplaceWith(imports = {}, expression = fetchDisplayAdsWithAu(cliUbid, pageType, productCount, adUnits, targetingParams, extraParams)), level = DeprecationLevel.WARNING) final Map<String, Object> fetch_display_ads_with_au(String cli_ubid, String page_type, Integer product_count, List<String> ad_units, Map<String, Object> targeting_params, Map<String, Object> extra_params)

        Fetches display ads using Ad Unit-based targeting.

        Parameters:
        cli_ubid - Unique client identifier
        page_type - Type of page requesting ads
        product_count - Number of products to display ads for
        ad_units - List of ad unit identifiers
        targeting_params - Optional: Targeting parameters for ad filtering
        extra_params - Optional: Additional parameters if required
      • fetch_display_ads_with_pt

        @Deprecated(message = Use fetchDisplayAdsWithPt instead, replaceWith = @ReplaceWith(imports = {}, expression = fetchDisplayAdsWithPt(cliUbid, pageName, pageType, productCount, filters, extraParams)), level = DeprecationLevel.WARNING) final Map<String, Object> fetch_display_ads_with_pt(String cli_ubid, String page_type, Integer product_count, Map<String, Object> targeting_params, Map<String, Object> extra_params)

        Fetches display ads using Page Type-based targeting.

        Parameters:
        cli_ubid - Unique client identifier
        page_type - Type of page requesting ads
        product_count - Number of products to display ads for
        targeting_params - Optional : Targeting parameters for ad filtering
        extra_params - Optional: Additional parameters if required
      • fetch_pla_search_page_ads

        @Deprecated(message = Use fetchPlaSearchPageAds instead, replaceWith = @ReplaceWith(imports = {}, expression = fetchPlaSearchPageAds(cliUbid, pageName, productCount, keywords, filters, extraParams)), level = DeprecationLevel.WARNING) final Map<String, Object> fetch_pla_search_page_ads(String cli_ubid, String page_name, Integer product_count, List<Object> keywords, Map<String, Object> filters, Map<String, Object> extra_params)

        Fetches PLA ads specifically for search pages.

        Parameters:
        cli_ubid - Unique identifier for the client.
        page_name - Optional: Name of the search results page.
        product_count - Number of products to display ads for.
        keywords - List of search keywords.
        filters - Optional: Map containing filter criteria as key-value pairs.
        extra_params - Optional: Additional parameters for the request.
      • fetch_pla_home_page_ads

        @Deprecated(message = Use fetchPlaHomePageAds instead, replaceWith = @ReplaceWith(imports = {}, expression = fetchPlaHomePageAds(cliUbid, pageName, productCount, filters, extraParams)), level = DeprecationLevel.WARNING) final Map<String, Object> fetch_pla_home_page_ads(String cli_ubid, String page_name, Integer product_count, Map<String, Object> filters, Map<String, Object> extra_params)

        Fetches Product Listing Ads (PLA) for the home page.

        Parameters:
        cli_ubid - Unique identifier for the client.
        page_name - Name of the home page requesting ads.
        product_count - Number of products to display ads for.
        filters - Optional: Map containing filter criteria; values can be of any type for flexibility.
        extra_params - Optional: Additional parameters for the request; defaults to an empty map.
      • fetch_pla_category_page_ads

        @Deprecated(message = Use fetchPlaCategoryPageAds instead, replaceWith = @ReplaceWith(imports = {}, expression = fetchPlaCategoryPageAds(cliUbid, pageName, productCount, categories, filters, extraParams)), level = DeprecationLevel.WARNING) final Map<String, Object> fetch_pla_category_page_ads(String cli_ubid, String page_name, Integer product_count, List<Object> categories, Map<String, Object> filters, Map<String, Object> extra_params)

        Fetches PLA ads for a category page.

        Parameters:
        cli_ubid - Unique identifier for the client.
        page_name - Optional: Name of the category page requesting ads.
        product_count - Number of products to display ads for.
        categories - List of categories to filter ads.
        filters - Optional: Map containing filter criteria as key-value pairs.
        extra_params - Optional: Additional parameters for the request; defaults to an empty map.
      • fetch_pla_product_page_ads

        @Deprecated(message = Use fetchPlaProductPageAds instead, replaceWith = @ReplaceWith(imports = {}, expression = fetchPlaProductPageAds(cliUbid, pageName, productCount, skuIds, filters, extraParams)), level = DeprecationLevel.WARNING) final Map<String, Object> fetch_pla_product_page_ads(String cli_ubid, String page_name, Integer product_count, List<Object> sku_ids, Map<String, Object> filters, Map<String, Object> extra_params)

        Fetches PLA ads for a product detail page.

        Parameters:
        cli_ubid - Unique identifier for the client.
        page_name - Optional: Name of the product page requesting ads.
        product_count - Number of products to display ads for.
        sku_ids - List of SKU identifiers for the products.
        filters - Optional: Map containing filter criteria as key-value pairs.
        extra_params - OPtional: Additional parameters for the request.
      • fetch_pla_purchase_page_ads

        @Deprecated(message = Use fetchPlaPurchasePageAds instead, replaceWith = @ReplaceWith(imports = {}, expression = fetchPlaPurchasePageAds(cliUbid, pageName, productCount, skuIds, filters, extraParams)), level = DeprecationLevel.WARNING) final Map<String, Object> fetch_pla_purchase_page_ads(String cli_ubid, String page_name, Integer product_count, List<Object> sku_ids, Map<String, Object> filters, Map<String, Object> extra_params)

        Fetches PLA ads for a purchase detail page.

        Parameters:
        cli_ubid - Unique identifier for the client.
        page_name - Optional: Name of the product page requesting ads.
        product_count - Number of products to display ads for.
        sku_ids - List of SKU identifiers for the products.
        filters - Optional: Map containing filter criteria as key-value pairs.
        extra_params - Optional: Additional parameters for the request.
      • fetch_tpa_page_ads

        @Deprecated(message = Use fetchTpaPageAds instead, replaceWith = @ReplaceWith(imports = {}, expression = fetchTpaPageAds(cliUbid, pageName, productCount, skuIds, filters, extraParams)), level = DeprecationLevel.WARNING) final Map<String, Object> fetch_tpa_page_ads(String cli_ubid, String page_name, Integer product_count, List<Object> sku_ids, Map<String, Object> filters, Map<String, Object> extra_params)

        POST API Call for Tagged Product Ads.

        This function constructs a JSON payload with the provided parameters and sends a POST request to the configured Tagged product ads. The response is logged for debugging purposes.

        Parameters:
        cli_ubid - Unique identifier for the client session.
        page_name - Optional: Name of the page requesting ads.
        product_count - Number of products to display ads for.
        sku_ids - List of SKU identifiers related to the products.
        filters - Optional: Map containing filter criteria; values can be of any type for flexibility.
        extra_params - Optional: Additional parameters for the request; values can be of any type.