QueryObject
The Class that represents StubHub Unified Search Query object. Use this class for constructing the URL path and query parameters for a StubHub search API. This is a sample URL path with query parameters (which appear after the StubHub domain name) to search for events that take place in ‘San Francisco OR New York':
https://api.stubhub.com/search/catalog/events/v3/?city="San Francisco”|"New York"
(protected) new QueryObject()
Members
type
Query type
Type
- String
Methods
contains
contains(key, substring) → {Query}
Searches for string values that contain the provided string.
NOTE: If you are performing this query on a large dataset, the search may take more processing time to return the results.
Parameters
Name | Type | Description |
---|---|---|
key | String | The key that the string to match is stored in.
|
substring | String | Array.<String>
| The substring that the value must contain, or a list of substrings that at least one of the substrings contains the provided string.
|
Returns
dateRange
dateRange(start, end) → {Query}
Parameters
Name | Type | Description |
---|---|---|
start | String | Date
| The beginning of the date range. This is specified as a string in the format yyyy-MM-dd or as a JavaScript Date object.
|
end | String | Date
| The end of the date range. This is specified as a string in the format yyyy-MM-dd or as a JavaScript Date object.
|
Returns
equalTo
equalTo(key, value) → {Query}
Restricts the query to return only the value of a key that is equal to the provided value.
Parameters
Name | Type | Description |
---|---|---|
key | String | The key to search for.
|
value | String | Array.<String>
| The value of the key to match, or a list of comma-separated values to find at least one match.
|
Returns
hasTicket
hasTicket(b) → {Query}
Parameters
Name | Type | Description |
---|---|---|
b | Boolean | True means search for an event that has tickets on sale. False means ignore the event that has tickets on sale.
|
Returns
localDate
localDate(d) → {Query}
Parameters
Name | Type | Description |
---|---|---|
d | String | Date
| A date string in the format yyyy-MM-dd(THH:mm) or a JavaScript Date object.
|
Returns
localDateRange
localDateRange(start, end) → {Query}
Parameters
Name | Type | Description |
---|---|---|
start | String | Date
| The beginning of the date range. Specify this as a string in the format yyyy-MM-dd or as a JavaScript Date object.
|
end | String | Date
| The end of the date range. Specify this as a string in the format yyyy-MM-dd or as a JavaScript Date object.
|
Returns
locateAt
locateAt(location) → {Query}
Specify a property of the location object to search for.
NOTE: This method only applies to a Query object whose type is Event or Venue.
Parameters
Name | Type | Description | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
location | Object | Represents the location object, which has the properties as described in the table below.
Properties
|
Returns
notContains
notContains(key, substring) → {Query}
Searches for string values that do not contain a provided string.
NOTE: If you are performing this query on a large dataset, the search may take more processing time to return the results.
Parameters
Name | Type | Description |
---|---|---|
key | String | The key that the string to match is stored in.
|
substring | String | The substring that the value must not contain.
|
Returns
sort
sort() → {Query}
Sort the query results.
NOTE: Each type of Query has a different set of available sort fields. See the examples below.
Parameters
Returns
Example
// For an event query, the available sort fields are 'popularity', 'name','eventDateLocal', or 'distance'. new Query('Event').sort('eventDateLocal'); // For a venue query, the available sort fields are 'name', or 'distance'. new Query('Venue').sort('distance'); // For a performer query, the available sort field is 'name'. new Query('Performer').sort('name');
withInMiles
withInMiles(point, Maximum) → {Query}
Specifies the maxmium distance (or radius) from a given GeoPoint that a query searches for events.
NOTE: This method only applies to a Query object that has a type of Event or Venue.
Parameters
Name | Type | Description |
---|---|---|
point | Refers to the specified GeoPoint.
| |
Maximum | Number | The distance (in miles) of results to return.
|