Class ContentDiscovery


  • public class ContentDiscovery
    extends java.lang.Object

    Package Starting Point - The Content Discovery module provides dynamic ways to browse the content metadata and increase the flexibility for searching, filtering and organizing the content libraries. The content is airline specific.



    Categories can be retrieved by root content type, such as media or games.

    Items can be retrieved by the specific content type, such as media.video.movie, media.video.tvepisode and media.audio.music. In addition, Items can be retrieved by descriptor sets, such as genres, languages, actor, director, ratings or a custom value defined by the airline.

    This class includes a series of get methods for the various types of data. Data are passed back in ContentDiscovery.Listener callbacks. If the data is retrieved successfully, ContentDiscovery.Listener.onMapDataReceived(List, List, Map, Method, Map) or ContentDiscovery.Listener.onStringDataReceived(List, List, Method, Map) is called.

    If an error occurs, ContentDiscovery.Listener.onError(Error, Method, Map) is called.

    To limit the responses, applications can specify request-specific filter parameters, such as seat class, by Set methods.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String SDK_VERSION  
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void getCategories​(java.lang.String contentName, java.util.Map<java.lang.String,​java.lang.String> filter, ContentDiscovery.Listener listener)
      Retrieves all categories available for specified content name.
      void getContentTypes​(java.lang.String contentName, java.util.Map<java.lang.String,​java.lang.String> filter, ContentDiscovery.Listener listener)
      Retrieves all content types that are available for the specified content name.
      void getFieldValues​(java.lang.String fieldName, java.util.Map<java.lang.String,​java.lang.String> filter, ContentDiscovery.Listener listener)
      Retrieves all field values that are available for the specified field name.
      void getItems​(java.lang.String contentType, java.util.Map<java.lang.String,​java.lang.String> filter, ContentDiscovery.Listener listener)
      Retrieves all items for specified content_type.
      void getItemsbyCategories​(java.lang.String contentType, java.util.List<java.lang.Integer> categoryIds, java.util.Map<java.lang.String,​java.lang.String> filter, ContentDiscovery.Listener listener)
      Retrieves list of all items for multiple categories and grouped by category.
      void getItemsDetail​(java.util.List<java.lang.String> contentUris, java.util.Map<java.lang.String,​java.lang.String> filter, ContentDiscovery.Listener listener)
      Retrieves detailed information for Items by list of content URIs.
      void getLanguages​(java.util.Map<java.lang.String,​java.lang.String> filter, ContentDiscovery.Listener listener)
      Retrieves information on languages where metadata translations are available.
      void getTags​(java.lang.String contentType, java.util.Map<java.lang.String,​java.lang.String> filter, ContentDiscovery.Listener listener)
      Retrieves all tag names for fields indexed by content_type.
      void getTagValues​(java.lang.String contentType, java.util.List<java.lang.String> tagNames, java.util.Map<java.lang.String,​java.lang.String> filter, ContentDiscovery.Listener listener)
      Retrieves all the distinct values for a specific tag by content_type.
      static void initService​(Context context, IInFlightCallback inFlightCallback, InFlight inFlight)
      This API is the starting point for Content Discovery -- Initializes the service object and returns the object with the IInFlightCallback.
      void remove()
      Clean up CDV2 internal object and singletons
      void searchByField​(java.util.Map<java.lang.String,​java.lang.String> requiredFields, java.util.Map<java.lang.String,​java.lang.String> filter, ContentDiscovery.Listener listener)
      Searches content by field value.
      void searchByText​(java.lang.String text, java.util.Map<java.lang.String,​java.lang.String> filter, ContentDiscovery.Listener listener)
      Searches content by free text in the Title, Genre, Year, Artist, Actor and Director fields.
      void setLanguage​(java.lang.String languageCode)
      Sets the ISO 639-3 language code.
      void setSeatClass​(java.lang.String seatClass)
      Sets the seat class, such as first or business.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • SDK_VERSION

        public static final java.lang.String SDK_VERSION
    • Method Detail

      • initService

        public static void initService​(Context context,
                                       IInFlightCallback inFlightCallback,
                                       InFlight inFlight)
        This API is the starting point for Content Discovery -- Initializes the service object and returns the object with the IInFlightCallback.
        Parameters:
        context - Provides access to resources and classes to initialize the object.
        inFlightCallback - Returns the instance or error message.
        inFlight - Initializes an InFlight instance.
        Example:
              mInFlight = new InFlight();
              ContentDiscovery.initService(activity,
                     new IInFlightCallback() {
                     @Override
                      public void onInitServiceComplete(Object o, String s) {
                          Log.i(TAG, "onInitServiceComplete()", "Service initialization complete", Log.params("service", s));
                          ContentDiscovery cd = (ContentDiscovery) o;
        
                          cd.setSeatClass(MetadataV1.SeatClass.ALL);
                          cd.setLanguage("eng");
                      }
        
                      @Override
                      public void onInitServiceFailed(String s, InFlight.Error error) {
                          Log.e(TAG, "onInitServiceFailed()", "Service initialization failed", Log.params("service", s, "error", error));
                      }
                 }, mInFlight);
         
      • setSeatClass

        public void setSeatClass​(java.lang.String seatClass)
        Sets the seat class, such as first or business.

        If not specified, SeatClass.All will be used.
        Parameters:
        seatClass - Only accepts strings provided by SeatClass, such as first, business or all.
      • setLanguage

        public void setLanguage​(java.lang.String languageCode)
        Sets the ISO 639-3 language code. For example, the language code for English is eng and for German is deu.

        If not specified, the default language on the passenger's device is used.

        If the specified language is not available, the default language for the airline is returned.
        Parameters:
        languageCode - ISO 639-3 language code.
      • getCategories

        public void getCategories​(java.lang.String contentName,
                                  java.util.Map<java.lang.String,​java.lang.String> filter,
                                  ContentDiscovery.Listener listener)
        Retrieves all categories available for specified content name. Content is returned in the order specified from the Ground.
        Parameters:
        contentName - Required. Identifies the content. Examples: media, games and ebooks.
        filter - Optional. Request parameters, such as: category_root, parent_id, tree_depth and image_size_selector.
        listener - Data is passed back in the form of a listener. If data is retrieved successfully, ContentDiscovery.Listener.onMapDataReceived(List, List, Map, Method, Map) is called. If an error occurs, ContentDiscovery.Listener.onError(Error, Method, Map) is called.
      • getItems

        public void getItems​(java.lang.String contentType,
                             java.util.Map<java.lang.String,​java.lang.String> filter,
                             ContentDiscovery.Listener listener)
        Retrieves all items for specified content_type.
        Parameters:
        contentType - Required. Identifies the content. Comma separated list, where each token supports ending with wildcard. Examples: media.*, media.video.*, media.audio.*.
        filter - Optional. Request parameters, such as: offset, page_size, requested_fields, image_size_selector and image_resolution.
        listener - Data is passed back in the form of a listener. If data is retrieved successfully, ContentDiscovery.Listener.onMapDataReceived(List, List, Map, Method, Map) is called. If an error occurs, ContentDiscovery.Listener.onError(Error, Method, Map) is called.
      • getItemsbyCategories

        public void getItemsbyCategories​(java.lang.String contentType,
                                         java.util.List<java.lang.Integer> categoryIds,
                                         java.util.Map<java.lang.String,​java.lang.String> filter,
                                         ContentDiscovery.Listener listener)
        Retrieves list of all items for multiple categories and grouped by category.
        Parameters:
        contentType - Required. Identifies the content. Comma separated list, where each token supports ending with wildcard. Examples: media,games,ebook,media.video.*, media.video.movie.
        categoryIds - Required. List of category IDs for which you want to fetch the items.
        filter - Optional. Request parameters, such as: offset, page_size, requested_fields, image_size_selector and image_resolution.
        listener - Data is passed back in the form of a listener. If data is retrieved successfully, ContentDiscovery.Listener.onMapDataReceived(List, List, Map, Method, Map) is called. If an error occurs, ContentDiscovery.Listener.onError(Error, Method, Map) is called.
      • getTags

        public void getTags​(java.lang.String contentType,
                            java.util.Map<java.lang.String,​java.lang.String> filter,
                            ContentDiscovery.Listener listener)
        Retrieves all tag names for fields indexed by content_type. Sample tag list includes genre, rating, year or a custom tag defined by the airline.
        Parameters:
        contentType - Required. Identifies the content. Comma separated list, where each token supports ending with wildcard, for example, media.*, media.video.* , media.audio.*.
        listener - Data is passed back in the form of a listener. If data is retrieved successfully, ContentDiscovery.Listener.onStringDataReceived(List, List, Method, Map) is called. If an error occurs, ContentDiscovery.Listener.onError(Error, Method, Map) is called.
      • getTagValues

        public void getTagValues​(java.lang.String contentType,
                                 java.util.List<java.lang.String> tagNames,
                                 java.util.Map<java.lang.String,​java.lang.String> filter,
                                 ContentDiscovery.Listener listener)
        Retrieves all the distinct values for a specific tag by content_type. For example, the distinct values for the tag_name 'genre'.
        Parameters:
        contentType - Required, identifies the content. Comma separated list, where each token supports ending with wildcard. Examples: media.*, media.video.* , media.audio.*.
        tagNames - Required. Pre-defined or custom field that can be specific to the airline. This value should come from the "get_tags" API. If more than one custom field is given, use an "OR" between the custom fields.
        filter - Optional. Request parameters, such as: tag_filter_value, image_size_selector and image_resolution.
        listener - Data is passed back in the form of a listener. If data is retrieved successfully, ContentDiscovery.Listener.onMapDataReceived(List, List, Map, Method, Map) is called. If an error occurs, ContentDiscovery.Listener.onError(Error, Method, Map) is called.
      • searchByField

        public void searchByField​(java.util.Map<java.lang.String,​java.lang.String> requiredFields,
                                  java.util.Map<java.lang.String,​java.lang.String> filter,
                                  ContentDiscovery.Listener listener)
        Searches content by field value.
        Parameters:
        requiredFields - Required. Specify one or multiple fields. Service will perform "AND" operation between multiple fields.
        filter - Optional. Request parameters, such as: content_type, match_type, offset, page_size and requested_fields.
        listener - Data is passed back in the form of a listener. If data is retrieved successfully, ContentDiscovery.Listener.onMapDataReceived(List, List, Map, Method, Map) is called. If an error occurs, ContentDiscovery.Listener.onError(Error, Method, Map) is called.
      • searchByText

        public void searchByText​(java.lang.String text,
                                 java.util.Map<java.lang.String,​java.lang.String> filter,
                                 ContentDiscovery.Listener listener)
        Searches content by free text in the Title, Genre, Year, Artist, Actor and Director fields.
        Parameters:
        text - Required. Sets the filter text. This is free text that is searched in the Title, Genre, Year, Artist, Actor and Director fields.
        filter - Optional. Request parameters, such as: content_type, match_type, offset, page_size and requested_fields.
        listener - Data is passed back in the form of a listener. If data is retrieved successfully, ContentDiscovery.Listener.onMapDataReceived(List, List, Map, Method, Map) is called. If an error occurs, ContentDiscovery.Listener.onError(Error, Method, Map) is called.
      • remove

        public void remove()
        Clean up CDV2 internal object and singletons