Making API Calls

API requests in the iOS library are usually created using two objects, the NIKERequest class and the NIKECredential. These two objects are used to create an NSMutableURLRequest that can be used in the networking library of your choice. For example, here are the calls necessary to create a list activity request; yesterday and today are NSDate objects, offset refers to a starting point in a potentially long list of activities, and count is the amount of activites you would like. The request is authenticated, and then passed to NSURLSession.
        // Yesterday and today are NSDates. Offset is a starting point, count is the amount of activities.
        //
        NIKERequest *request = [NIKEStandardRequest getListActivitiesWithStart:yesterday
                                                                           end:today
                                                                        offset:@1
                                                                         count:@5
                                                                        locale:[NSLocale localeWithLocaleIdentifier:@"en_GB"]];
        request.credential = [Nike credential];
        [[NSURLSession sharedSession] dataTaskWithRequest:request.mutableURLRequest
                                        completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
            NSLog(@"Do some interesting things");
        }];