Inherits from NSObject
Declared in SGQuery.h

Overview

SGQuery builds URLs for querying the SeatGeek Platform. See the SeatGeek Platform docs for available endpoints and parameters.

Tasks

Setup

  • + setClientId:

    Some SeatGeek Platform endpoints require an API key. Set clientId to your API key in your AppDelegate’s application:didFinishLaunchingWithOptions:

  • + setAid:

    An optional aid value to append to all queries. Set this value in your AppDelegate’s application:didFinishLaunchingWithOptions:

  • + setRid:

    An optional rid value to append to all queries. Set this value in your AppDelegate’s application:didFinishLaunchingWithOptions:

  • + setConsoleLogging:

    Output debug information to console. Default is NO.

  • + consoleLogging

Event queries

Performer queries

Venue queries

The payoff

  • – URL

    Returns an NSURL for the constructed API query.

Pagination

  •   page

    The results page to fetch. Page numbers start from 1.

    property
  •   perPage

    The number of results to return per page. Default is 10.

    property

Keyword searches

  •   search

    Apply a keyword search to the query.

    property

Geolocation filters

  •   location

    Filter results by a location coordinate.

    property
  •   range

    Specify a range for location based filters. Accepts miles (“mi”) and kilometres (“km”). Default is “30mi”.

    property

Other parameters and filters

Properties

location

@property (nonatomic, assign) CLLocationCoordinate2D location
Discussion

Filter results by a location coordinate.

Declared In

SGQuery.h

page

@property (nonatomic, assign) NSUInteger page
Discussion

The results page to fetch. Page numbers start from 1.

Declared In

SGQuery.h

perPage

@property (nonatomic, assign) NSUInteger perPage
Discussion

The number of results to return per page. Default is 10.

Declared In

SGQuery.h

range

@property (nonatomic, copy) NSString *range
Discussion

Specify a range for location based filters. Accepts miles (“mi”) and kilometres (“km”). Default is “30mi”.

Declared In

SGQuery.h

search

@property (nonatomic, copy) NSString *search
Discussion

Apply a keyword search to the query.

SGQuery *query = SGQuery.eventsQuery;
query.search = @"imagine dragons";

Declared In

SGQuery.h

Class Methods

consoleLogging

+ (BOOL)consoleLogging

eventQueryForId:

+ (SGQuery *)eventQueryForId:(NSNumber *)eventId
Discussion

Returns a new SGQuery instance for fetching a single event by id.

Declared In

SGQuery.h

eventsQuery

+ (SGQuery *)eventsQuery
Discussion

Returns a new SGQuery instance for the /events endpoint.

Declared In

SGQuery.h

globalParameters

+ (NSMutableDictionary *)globalParameters

performerQueryForId:

+ (SGQuery *)performerQueryForId:(NSNumber *)performerId
Discussion

Returns a new SGQuery instance for fetching a single performer by id.

Declared In

SGQuery.h

performerQueryForSlug:

+ (SGQuery *)performerQueryForSlug:(NSString *)slug
Discussion

Returns a new SGQuery instance for fetching a single performer by slug.

Declared In

SGQuery.h

performersQuery

+ (SGQuery *)performersQuery
Discussion

Returns a new SGQuery instance for the /performers endpoint.

Declared In

SGQuery.h

queryWithString:

+ (SGQuery *)queryWithString:(NSString *)string

recommendationsQuery

+ (SGQuery *)recommendationsQuery
Discussion

Returns a new SGQuery instance for the /recommendations endpoint.

Warning: The /recommendations endpoint requires an API key. See setClientId: for details.

Declared In

SGQuery.h

setAid:

+ (void)setAid:(NSString *)aid
Discussion

An optional aid value to append to all queries. Set this value in your AppDelegate’s application:didFinishLaunchingWithOptions:

SGQuery.aid = @"my_aid";

Declared In

SGQuery.h

setClientId:

+ (void)setClientId:(NSString *)clientId
Discussion

Some SeatGeek Platform endpoints require an API key. Set clientId to your API key in your AppDelegate’s application:didFinishLaunchingWithOptions:

SGQuery.clientId = @"my_API_key";

Declared In

SGQuery.h

setConsoleLogging:

+ (void)setConsoleLogging:(BOOL)logging
Discussion

Output debug information to console. Default is NO.

Declared In

SGQuery.h

setRid:

+ (void)setRid:(NSString *)rid
Discussion

An optional rid value to append to all queries. Set this value in your AppDelegate’s application:didFinishLaunchingWithOptions:

 SGQuery.rid = @"my_rid";

Declared In

SGQuery.h

venueQueryForId:

+ (SGQuery *)venueQueryForId:(NSNumber *)venueId
Discussion

Returns a new SGQuery instance for fetching a single venue by id.

Declared In

SGQuery.h

venuesQuery

+ (SGQuery *)venuesQuery
Discussion

Returns a new SGQuery instance for the /venues endpoint.

Declared In

SGQuery.h

Instance Methods

URL

- (NSURL *)URL
Discussion

Returns an NSURL for the constructed API query.

SGQuery *query = SGQuery.eventsQuery;
query.search = @"imagine dragons";

NSLog(@"%@", query.URL);
// http://api.seatgeek.com/2/events?q=imagine+dragons

Declared In

SGQuery.h

addFilter:value:

- (void)addFilter:(NSString *)filter value:(id)value
Discussion

Add a results filter. Filters are stacked, and the same filters can be applied multiple times with different values. See the API docs for available filters.

[query addFilter:@"performers.slug" value:@"new-york-mets"];
[query addFilter:@"performers.slug" value:@"new-york-yankees"];

Declared In

SGQuery.h

setParameter:value:

- (void)setParameter:(NSString *)param value:(id)value
Discussion

Set a query parameter. Setting a parameter will override its previous value. See the API docs for available parameters.

[query setParameter:@"format" value:@"xml"];
[query setParameter:@"sort" value:@"announce_date.desc"];

Declared In

SGQuery.h