LIFXAPIWrapper 0.0.5

LIFXAPIWrapper 0.0.5

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Nov 2016

Maintained by Maxime de Chalendar.



Usage

To run the example project, clone the repo, and run pod install from the Example directory first.

Here's a quickie :

- (void)doSomeStuffWithTheLIFXAPI
{
    LIFXAPIWrapper *APIWrapper = [LIFXAPIWrapper sharedAPIWrapper];
    [APIWrapper setOAuthToken:@"Your-OAuth-Token"]; // See below how to generate one

    [APIWrapper getAllLightsWithCompletion:^(NSArray *lights) {
    NSLog(@"Fetched all lights: %@", lights);

    LIFXLight *light = lights.firstObject;
    LIFXTargetOperationUpdate *brightnessUpdate = [LIFXTargetOperationUpdate updateWithBrightness:.5];
        [APIWrapper applyUpdate:brightnessUpdate toTarget:light onCompletion:^(NSArray *results) {
            NSLog(@"Brightness update result : %@", results);

        } onFailure:^(NSError *error) {
            NSLog(@"Couldn't appy update: %@", error); 
        }];

    } onFailure:^(NSError *error) {
        NSLog(@"Couldn't fetch lights: %@", error); 
    }];
}

All the classes, methods and property are documented, so you should be able understand it quite easily.

Authentication

The LIFX HTTP API authenticates using an OAuthToken, generate yours on your LIFX Clour settings page.
Unfortunately, username/password combination is NOT supported yet.
All the informations you might need are available on LIFX's documentation page.

Installation

LIFXAPIWrapper is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "LIFXAPIWrapper"

Author

Maxime de Chalendar, [email protected]

License

LIFXAPIWrapper is available under the MIT license. See the LICENSE file for more info.