## ActionQuery

**This class is deprecated.**

Button Actions has been deprecated. Please contact Button to update your integration.

## Class Overview

This is the main class holding context information for the current screen of your application. Create an instance of this class and set relevant information representing the information presented to the user so the appropriate button can be created with as much information as possible.

An instance of this class can be passed to `ActionRequest(String, ActionQuery)` to prepare a request to fetch a `ButtonAction`.

**Location Example** context for a screen showing information about a restaurant where we want to provide the user with transportation methods from their location to the venue:

```java
DropinButton button = (DropinButton) findViewById(R.id.button);
final Location restaurant = new Location("Feast", 40.7325614, -73.988068);
final ActionQuery query = ActionQuery.withSubjectLocation(restaurant);
query.setUserLocation(new Location("Work", 40.7382869, -73.9823721));
final ActionRequest request = new ActionRequest("btn-abc123", query);
Button.actions().fetch(request, new ActionListener() {
    @Override
    public void onComplete(@Nullable ButtonAction action, @Nullable Throwable t) {
        if (action == null) return;
        button.prepareWithAction(action);
    }
});
```

**Event Example** context for a screen showing event information, for example a calendar event.
This context information can in turn be used for e.g. on demand parking or nearby restaurants for when the show is over.

```java
final Event event = new Event("Concert at Madison Square Garden");
event.setStart(new Date());
event.setEnd(new Date(System.currentTimeMillis() + 3 * 3600 * 1000));
final Location msg = new Location("Madison Square Garden", 40.7505045, -73.9956274);
event.setLocation(msg);
```

## Summary

| Public Constructors |
| --- |
|  | [ActionQuery](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/action/ActionQuery.html#ActionQuery())() |

| Public Methods |
| --- |
| [ActionQuery](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/action/ActionQuery.html) | [addItem](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/action/ActionQuery.html#addItem(com.usebutton.sdk.context.Item))( [Item](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/context/Item.html) item)<br>Add an item to the context, for example the items of a shopping cart or ingredients of a recipe. |
| static<br>[ActionQuery](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/action/ActionQuery.html) | [deepCopy](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/action/ActionQuery.html#deepCopy(com.usebutton.sdk.action.ActionQuery))( [ActionQuery](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/action/ActionQuery.html) context)<br>This method will create a new instance of context, creating a deep copy of all values. |
| [ActionQuery](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/action/ActionQuery.html) | [setArtist](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/action/ActionQuery.html#setArtist(com.usebutton.sdk.context.MusicArtist))( [MusicArtist](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/context/MusicArtist.html) artist)<br>Sets an artist object represented by the current screen, for example for a streaming music player you would here set the artist for the track currently playing. |
| [ActionQuery](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/action/ActionQuery.html) | [setDate](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/action/ActionQuery.html#setDate(java.util.Date))( [Date](https://d.android.com/reference/java/util/Date.html) date)<br>Sets the time and date for the information represented on screen - the time of a reservation, date of a hotel reservation or similar. |
| [ActionQuery](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/action/ActionQuery.html) | [setDateRange](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/action/ActionQuery.html#setDateRange(java.util.Date,%20java.util.Date))( [Date](https://d.android.com/reference/java/util/Date.html) startDate, [Date](https://d.android.com/reference/java/util/Date.html) endDate)<br>Sets the date range relevant to the current screen, for a concert this could be the start and end time of the concert or the start and end time for a calendar event. |
| [ActionQuery](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/action/ActionQuery.html) | [setEvent](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/action/ActionQuery.html#setEvent(com.usebutton.sdk.context.Event))( [Event](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/context/Event.html) event)<br>Sets an event to this context, an example would be a calendar reminder representing a location and start & end time. |
| [ActionQuery](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/action/ActionQuery.html) | [setJourney](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/action/ActionQuery.html#setJourney(com.usebutton.sdk.context.Journey))( [Journey](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/context/Journey.html) journey)<br>Sets a journey object to this context, this will represent for example a trip with a start & end location, travel method and start & end time. |
| [ActionQuery](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/action/ActionQuery.html) | [setSubjectLocation](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/action/ActionQuery.html#setSubjectLocation(com.usebutton.sdk.context.Location))( [Location](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/context/Location.html) location)<br>Sets the physical location represented by the current screen, this can have coordinates, a structured address or simply just a name. |
| [ActionQuery](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/action/ActionQuery.html) | [setURL](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/action/ActionQuery.html#setURL(Uri))(Uri uri)<br>Sets a URL as context, we can use this to enrich the context with more information from the provided URL. |
| [ActionQuery](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/action/ActionQuery.html) | [setUserLocation](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/action/ActionQuery.html#setUserLocation(com.usebutton.sdk.context.Location))( [Location](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/context/Location.html) location)<br>The current location of the user. |

### Static Methods

| Public Static Methods |
| --- |
| [ActionQuery](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/action/ActionQuery.html) | [withArtist](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/action/ActionQuery.html#withArtist(com.usebutton.sdk.context.MusicArtist))( [MusicArtist](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/context/MusicArtist.html) artist)<br>Creates a new ActionQuery instance and calls `setArtist(MusicArtist)`. |
| [ActionQuery](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/action/ActionQuery.html) | [withDate](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/action/ActionQuery.html#withDate(java.util.Date))( [Date](https://d.android.com/reference/java/util/Date.html) date)<br>Creates a new ActionQuery instance and calls `setDate(Date)`. |
| [ActionQuery](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/action/ActionQuery.html) | [withDateRange](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/action/ActionQuery.html#withDateRange(java.util.Date,%20java.util.Date))( [Date](https://d.android.com/reference/java/util/Date.html) startDate, [Date](https://d.android.com/reference/java/util/Date.html) endDate)<br>Creates a new ActionQuery instance and calls `setDateRange(Date, Date)`. |
| [ActionQuery](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/action/ActionQuery.html) | [withEvent](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/action/ActionQuery.html#withEvent(com.usebutton.sdk.context.Event))( [Event](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/context/Event.html) event)<br>Creates a new ActionQuery instance and calls `setEvent(Event)`. |
| [ActionQuery](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/action/ActionQuery.html) | [withJourney](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/action/ActionQuery.html#withJourney(com.usebutton.sdk.context.Journey))( [Journey](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/context/Journey.html) journey)<br>Creates a new ActionQuery instance and calls `setJourney(Journey)`. |
| [ActionQuery](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/action/ActionQuery.html) | [withSubjectLocation](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/action/ActionQuery.html#withSubjectLocation(com.usebutton.sdk.context.Location))( [Location](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/context/Location.html) location)<br>Creates a new ActionQuery instance and calls `setSubjectLocation(Location)`. |
| [ActionQuery](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/action/ActionQuery.html) | [withUserLocation](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/action/ActionQuery.html#withUserLocation(com.usebutton.sdk.context.Location))( [Location](https://building.usebutton.com/button-android/latest/reference/com/usebutton/sdk/context/Location.html) location)<br>Creates a new ActionQuery instance and calls `setUserLocation(Location)`. |
