Documentation
iOS ReferenceAndroid Reference
  • Overview
  • Release Notes
    • 2019 Release Notes
  • Quick Start
    • Configuration settings
  • Getting Started
    • Environments
    • Domain Whitelist
  • Traveler
    • Overview
    • Mobile SDKs
      • Overview
      • Minimum Requirements
      • iOS
        • Installation
        • Getting Started
      • Android
        • Installation
        • Getting Started
      • Usage
        • Booking Item Search
          • Booking Item Search UI
        • Flight Search
        • Catalog
        • Catalog Item Details
        • Availabilities
        • Getting Passes
        • Booking Form
          • Questions
          • Answers
          • Validation
        • Creating an Order
        • Processing an Order
      • Errors
    • Traveler API
    • Payments
  • Partner
    • Overview
    • Partner API
  • Glossary
    • API Convention
      • Error Codes
      • API Rate Limiting
    • Terminology
  • Support
    • Contact
Powered by GitBook
On this page

Was this helpful?

  1. Traveler
  2. Mobile SDKs
  3. Usage

Catalog

Use this method to fetch a personalized catalog of purchasable items

let query = CatalogQuery()
Traveler.fetchCatalog(query: query) { (catalog, error) in 

}

Alternatively you can use the delegate pattern

Traveler.fetchCatalog(query: query, delegate: self)
extension MyViewController: CatalogFetchDelegate {
    func catalogFetchDidSucceedWith(_ result: Catalog) {
    
    }
    
    func catalogFetchDidFailWith(_ error: Error) {
    
    }
}

The UI SDK ships with a view controller which you can use (and/or subclass) to display the catalog. If you wish you can also use them via storyboards, just remember to pass along the Catalog instance.

let catalogResultVC = CatalogResultViewController()
catalogResultVC.catalog = catalog
present(catalogResultVC, animated: true)

Should you require further customization, the UI SDK ships with a CatalogView that provides the basics of displaying two dimensional data.

CatalogQuery query = new CatalogQuery();
Traveler.fetchCatalog(query, new CatalogSearchCallback() {
    @Override
    public void onCatalogSearchSuccess(Catalog catalog) {
    
    }
    
    @Override
    public void onCatalogSearchError(Error error) {
    
    }
});

The UI SDK ships with a fragment to handle the display of the fetched Catalog. To include this fragment add a <FrameLayout> to your Activity's layout XML:

    <FrameLayout
            android:id="@+id/catalogContainer"
            android:layout_width="match_parent"
            android:layout_height="match_parent"/>

And in your Activity's onCreate() the CatalogFragment

protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
        
    CatalogFragment catalogFragment = CatalogFragment.newInstance(catalog);
        
    FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
    transaction.replace(R.id.catalogContainer, catalogFragment);
    
    transaction.commit();    
}
PreviousFlight SearchNextCatalog Item Details

Last updated 5 years ago

Was this helpful?