Activity (Social Actions)

Introduction

Socialize allows you to retrieve information about what’s going on in your app. All of the activity-related functionality can be found in the SZActionUtils class.

Working with Actions

To retrieve the raw list of actions performed by a user

- (void)getActionsByUserOnAllEntities {
    [SZActionUtils getActionsByUser:nil start:nil end:nil success:^(NSArray *actions) {
        for (id<SZActivity> action in actions) {
            NSLog(@"Found action %d by user %@ %@", [action objectID], [action.user firstName], [action.user lastName]);
        }

    } failure:^(NSError *error) {
        NSLog(@"Failure: %@", [error localizedDescription]);
    }];
}

Or get the list of actions by a single user on a single entity

- (void)getActionsByUserOnSingleEntity {
    SZEntity *entity = [SZEntity entityWithKey:@"interesting_key"];
    
    [SZActionUtils getActionsByUser:nil entity:entity start:nil end:nil success:^(NSArray *actions) {
        for (id<SZActivity> action in actions) {
            NSLog(@"Found action %d by user %@ %@", [action objectID], [action.user firstName], [action.user lastName]);
        }

    } failure:^(NSError *error) {
        NSLog(@"Failure: %@", [error localizedDescription]);
    }];
}

Or get the list of actions by all users on a single entity

- (void)getActionsForAllUsersOnASingleEntity {
    SZEntity *entity = [SZEntity entityWithKey:@"interesting_key"];
    
    [SZActionUtils getActionsByEntity:entity start:nil end:nil success:^(NSArray *actions) {
        for (id<SZActivity> action in actions) {
            NSLog(@"Found action %d by user %@ %@", [action objectID], [action.user firstName], [action.user lastName]);
        }

    } failure:^(NSError *error) {
        NSLog(@"Failure: %@", [error localizedDescription]);
    }];
}

Or list activity for the entire application

- (void)getActionsByApplication {
    [SZActionUtils getActionsByApplicationWithStart:nil end:nil success:^(NSArray *actions) {
        for (id<SZActivity> action in actions) {
            NSLog(@"Found action %d by user %@ %@", [action objectID], [action.user firstName], [action.user lastName]);
        }
        
    } failure:^(NSError *error) {
        NSLog(@"Failure: %@", [error localizedDescription]);
    }];
}