# Flight Search

{% tabs %}
{% tab title="iOS" %}

```swift
let query = FlightQuery(number: "AC01", date: Date())
Traveler.flightSearch(query: query) { (flights, error) in 
    // ...
}
```

Alternatively you can use the delegate pattern

```swift
Traveler.flightSearch(query: query, delegate: self)
```

```swift
extension MyViewController: FlightSearchDelegate {
    func flightSearchDidSucceedWith(_ result: [Flight]) {
    
    }
    
    func flightSearchDidFailWith(_ error: Error) {
    
    }
}
```

{% endtab %}

{% tab title="Android" %}

```java
FlightQuery query = new FlightQuery("AC01", new Date());
Traveler.flightSearch(query, new FlightSearchCallback() {
    @Override
    public void onFlightSearchSuccess(List<Flight> flights) {
    
    }
    
    @Override
    public void onFlightSearchError(Error error) {
    
    }
});
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.guestlogix.io/traveler/mobile-sdks/stripe-payment-sdk/flight-search.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
