Objective-CiOSiOSCocoaiOS SDK V4 Objects (BETA) API Reference for Realtime Apps

Creates a user with the specified properties. Returns the created user object, optionally including the user's custom data object.

To Create a User you can use the following method(s) in the Objective-C SDK:
  1. ParameterTypeRequiredDescription
    requestPNCreateUserRequestYesCreate user request with all information about new user which will be passed to PubNub service.
    blockPNCreateUserCompletionBlockNoCreate user request completion block.
    ParameterTypeRequiredDescription
    includeFieldsPNUserFieldsNoBitfield set to fields which should be returned with response. Set to PNUserCustomField to return the custom field set by a user create or update request.
    Default is PNUserCustomField. Set to 0 to reset the default value.
    externalIdNSStringNoUser identifier from external service (database, auth service).
    profileUrlNSStringNoURL at which user's profile available.
    customNSDictionaryNoAdditional / complex attributes which should be associated to user with specified identifier.
    emailNSStringNoEmail address which should be associated to user with specified identifier.
    nameNSStringYesName which should be associated with new user entry.
PNCreateUserRequest *request = [PNCreateUserRequest requestWithUserID:@"user-uuid"
                                                                 name:@"Serhii"];
request.externalId = @"93FVfHUAf4RLu79J7Q3ejLVu";
request.profileUrl = @"https://pubnub.com";
request.custom = @{ @"age": @(36) };
request.email = @"support@pubnub.com";

[self.client createUserWithRequest:request completion:^(PNCreateUserStatus *status) {
    if (!status.isError) {
        /**
         * User successfully created.
         * Created user information available here: status.data.user
         */
    } else {
        /**
         * Handle user create error. Check 'category' property to find out possible issue
         * because of which request did fail.
         *
         * Request can be resent using: [status retry]
         */
    }
}];

Response objects which is returned by client when create user Object API is used:

@interface PNCreateUserData : PNServiceData

// Created user object.
@property (nonatomic, nullable, readonly, strong) PNUser *user;

@end
 
 
@interface PNCreateUserStatus : PNAcknowledgmentStatus

// Create user request processed information.
@property (nonatomic, readonly, strong) PNCreateUserData *data;

@end

Creates a user with the specified properties. Returns the created user object, optionally including the user's custom data object.

To Create a User you can use the following method(s) in the Objective-C SDK:
  1. ParameterTypeRequiredDescription
    userIdNSStringYesUnique identifier for new user entry.
    nameNSStringYesName which should be associated with new user entry.
    externalIdNSStringNoUser identifier from external service (database, auth service).
    profileUrlNSStringNoURL at which user's profile available.
    customNSDictionaryNoAdditional / complex attributes which should be associated to user with specified userId.
    emailNSStringNoEmail address which should be associated to user with specified userId.
    includeFieldsPNUserFieldsNoBitfield with names of fields to be returned with the response. Set to PNUserCustomField to return the custom field set by a user create or update request. Omit this property if you do not want to retrieve the additional attributes.
    blockPNCreateUserCompletionBlockNoCreate user request completion block.
     
    This method uses the builder pattern, you can remove the arguments which are optional.
self.client.createUser()
    .userId(@"user-uuid")
    .name(@"Serhii")
    .externalId(@"93FVfHUAf4RLu79J7Q3ejLVu")
    .profileUrl(@"https://pubnub.com")
    .custom(@{ @"age": @(36) })
    .email(@"support@pubnub.com")
    .includeFields(PNUserCustomField)
    .performWithCompletion(^(PNCreateUserStatus *status) {
        if (!status.isError) {
            /**
             * User successfully created.
             * Created user information available here: status.data.user
             */
        } else {
            /**
             * Handle user create error. Check 'category' property to find out possible issue
             * because of which request did fail.
             *
             * Request can be resent using: [status retry]
             */
        }
    });

Response objects which is returned by client when create user Object API is used:

@interface PNCreateUserData : PNServiceData

// Created user object.
@property (nonatomic, nullable, readonly, strong) PNUser *user;

@end
 
 
@interface PNCreateUserStatus : PNAcknowledgmentStatus

// Create user request processed information.
@property (nonatomic, readonly, strong) PNCreateUserData *data;

@end

Updates a user with the specified properties. Returns the updated user object, optionally including the user's custom data object.

To Update a User you can use the following method(s) in the Objective-C SDK:
  1. ParameterTypeRequiredDescription
    requestPNUpdateUserRequestYesUpdate user request with all information which should be updated for existing user.
    blockPNUpdateUserCompletionBlockNoUpdate user request completion block.
    ParameterTypeRequiredDescription
    includeFieldsPNUserFieldsNoBitfield with names of fields to be returned with the response. Set to PNUserCustomField to return the custom field set by a user create or update request. Omit this property if you do not want to retrieve the additional attributes.
    externalIdNSStringNoUser from external service (database, auth service).
    profileUrlNSStringNoURL at which user's profile available.
    customNSDictionaryNo Additional / complex attributes which should be associated to user with specified userId.
    Partial update not available, whole object from previous create / update with changes should be passed.
    emailNSStringNoEmail address which should be associated to user with specified userId.
    nameNSStringNoName which should be associated with user entry. Name can't be empty or nil.
PNUpdateUserRequest *request = [PNUpdateUserRequest requestWithUserID:@"user-uuid"];
// With this option on, returned user model will have value set to 'custom' property.
request.includeFields = PNUserCustomField;
request.custom = @{ @"age": @(39), @"status": @"Checking some stuff..." };
request.name = @"David";

[self.client updateUserWithRequest:request completion:^(PNUpdateUserStatus *status) {
    if (!status.isError) {
        /**
         * User successfully updated.
         * Updated user information available here: status.data.user
         */
    } else {
        /**
         * Handle user update error. Check 'category' property to find out possible issue
         * because of which request did fail.
         *
         * Request can be resent using: [status retry]
         */
    }
}];

Response objects which is returned by client when update user Object API is used:

@interface PNUpdateUserData : PNServiceData

// Updated user object.
@property (nonatomic, nullable, readonly, strong) PNUser *user;

@end
 
 
@interface PNUpdateUserStatus : PNAcknowledgmentStatus

// Update user request processed information.
@property (nonatomic, readonly, strong) PNUpdateUserData *data;

@end

Updates a user with the specified properties. Returns the updated user object, optionally including the user's custom data object.

To Update a User you can use the following method(s) in the Objective-C SDK:
  1. ParameterTypeRequiredDescription
    userIdNSStringYesIdentifier of user which should be updated.
    nameNSStringNoName which should be associated with user entry. Name can't be empty or nil.
    externalIdNSStringNoUser identifier from external service (database, auth service).
    profileUrlNSStringNoURL at which user's profile available.
    customNSDictionaryNoAdditional / complex attributes which should be associated to user with specified userId.
    Partial update not available, whole object from previous create / update with changes should be passed.
    emailNSStringNoEmail address which should be associated to user with specified userId.
    includeFieldsPNUserFieldsNoBitfield with names of fields to be returned with the response. Set to PNUserCustomField to return the custom field set by a user create or update request. Omit this property if you do not want to retrieve the additional attributes.
    blockPNUpdateUserCompletionBlockNoUpdate user request completion block.
     
    This method uses the builder pattern, you can remove the arguments which are optional.
self.client.updateUser()
    .userId(@"user-uuid")
    .name(@"David")
    .custom(@{ @"age": @(39), @"status": @"Checking some stuff..." })
    .includeFields(PNUserCustomField)
    .performWithCompletion(^(PNUpdateUserStatus *status) {
        if (!status.isError) {
            /**
             * User successfully updated.
             * Updated user information available here: status.data.user
             */
        } else {
            /**
             * Handle user update error. Check 'category' property to find out possible issue
             * because of which request did fail.
             *
             * Request can be resent using: [status retry]
             */
        }
    });

Response objects which is returned by client when update user Object API is used:

@interface PNUpdateUserData : PNServiceData

// Updated user object.
@property (nonatomic, nullable, readonly, strong) PNUser *user;

@end
 
 
@interface PNUpdateUserStatus : PNAcknowledgmentStatus

// Update user request processed information.
@property (nonatomic, readonly, strong) PNUpdateUserData *data;

@end

Deletes the specified user object.

To Delete a User you can use the following method(s) in the Objective-C SDK:
  1. ParameterTypeRequiredDescription
    requestPNDeleteUserRequestYesDelete user request with information about existing user.
    blockPNDeleteUserCompletionBlockNoDelete user request completion block.
    ParameterTypeRequiredDescription
    userIdNSStringYesIdentifier of user which should be removed.
PNDeleteUserRequest *request = [PNDeleteUserRequest requestWithUserID:@"user-uuid"];

[self.client deleteUserWithRequest:request completion:^(PNAcknowledgmentStatus *status) {
    if (!status.isError) {
        // User successfully deleted.
    } else {
        /**
         * Handle user delete error. Check 'category' property to find out possible issue
         * because of which request did fail.
         *
         * Request can be resent using: [status retry]
         */
    }
}];

Response objects which is returned by client when delete user Object API is used:

@interface PNErrorData : PNServiceData

// Stringified error information.
@property (nonatomic, readonly, strong) NSString *information;

@end
 
 
@interface PNAcknowledgmentStatus : PNErrorStatus

// Whether status object represent error or not.
@property (nonatomic, readonly, assign, getter = isError) BOOL error;

// Additional information related to error status object.
@property (nonatomic, readonly, strong) PNErrorData *errorData;

@end

Deletes the specified user object.

To Delete a User you can use the following method(s) in the Objective-C SDK:
  1. ParameterTypeRequiredDescription
    userIdNSStringYesIdentifier of user which should be removed.
    blockPNDeleteUserCompletionBlockNoDelete user request completion block.
self.client.deleteUser()
    .userId(@"user-uuid")
    .performWithCompletion(^(PNAcknowledgmentStatus *status) {
        if (!status.isError) {
             // User successfully deleted.
        } else {
            /**
             * Handle user delete error. Check 'category' property to find out possible issue
             * because of which request did fail.
             *
             * Request can be resent using: [status retry]
             */
        }
    });

Response objects which is returned by client when delete user Object API is used:

@interface PNErrorData : PNServiceData

// Stringified error information.
@property (nonatomic, readonly, strong) NSString *information;

@end
 
 
@interface PNAcknowledgmentStatus : PNErrorStatus

// Whether status object represent error or not.
@property (nonatomic, readonly, assign, getter = isError) BOOL error;

// Additional information related to error status object.
@property (nonatomic, readonly, strong) PNErrorData *errorData;

@end

Returns a paginated list of user objects, optionally including each user's custom data object.

To Get Users you can use the following method(s) in the Objective-C SDK:
  1. ParameterTypeRequiredDescription
    requestPNFetchUsersRequestYesFetch all users request object with all information which should be used to fetch existing users.
    blockPNFetchUserCompletionBlockYesFetch all users request completion block.
    ParameterTypeRequiredDescription
    includeFieldsPNUserFieldsNoBitfield with names of fields to be returned with the response. Set to PNUserCustomField to return the custom field set by a user create or update request. Omit this property if you do not want to retrieve the additional attributes.
    includeCountBOOLNo Set to YES to return the total number of users included in the paginated response.
    Default is NO.
    startNSStringNoThe previously-returned cursor bookmark to fetch the next page of results.
    endNSStringNoThe previously-returned cursor bookmark to fetch the previous page of results.
    limitNSUIntegerNo The number of users to be returned in the response.
    Default is 100.
PNFetchUsersRequest *request = [PNFetchUsersRequest new];
request.start = @"<next from previous request>";
// Add this request option, if returned user models should have value set to 'custom' property.
request.includeFields = PNUserCustomField;
request.includeCount = YES;
request.limit = 40;

[self.client fetchUsersWithRequest:request
                        completion:^(PNFetchUsersResult *result, PNErrorStatus *status) {
    if (!status.isError) {
        /**
         * Users successfully fetched.
         * Result object has following information:
         *   result.data.users - list of fetched users
         *   result.data.next - cursor bookmark for fetching the next page.
         *   result.data.prev - cursor bookmark for fetching the previous page
         *   result.data.totalCount - total number of created users
         */
    } else {
        /**
         * Handle users fetch error. Check 'category' property to find out possible issue
         * because of which request did fail.
         *
         * Request can be resent using: [status retry]
         */
    }
}];

Response objects which is returned by client when fetch all users Object API is used:

@interface PNFetchUsersData : PNServiceData

// List of user objects created for current subscribe key.
@property (nonatomic, readonly, strong) NSArray<PNUser *> *users;

// Cursor bookmark for fetching the next page.
@property (nonatomic, nullable, readonly, strong) NSString *next;

// Cursor bookmark for fetching the previous page.
@property (nonatomic, nullable, readonly, strong) NSString *prev;

/**
 * Total number of users created for current subscribe key.
 *
 * Value will be 0 in case if 'includeCount' of PNFetchUsersRequest is set to 'NO'.
 */
@property (nonatomic, readonly, assign) NSUInteger totalCount;

@end
 
 
@interface PNFetchUsersResult : PNResult

// Fetch all users request processed information.
@property (nonatomic, readonly, strong) PNFetchUsersData *data;

@end

Error response which is used in case of Objects API call failure:

@interface PNErrorData : PNServiceData

// Stringified error information.
@property (nonatomic, readonly, strong) NSString *information;

@end
 
 
@interface PNErrorStatus : PNStatus

// Whether status object represent error or not.
@property (nonatomic, readonly, assign, getter = isError) BOOL error;

// Additional information related to error status object.
@property (nonatomic, readonly, strong) PNErrorData *errorData;

@end

Returns a paginated list of user objects, optionally including each user's custom data object.

To Get Users you can use the following method(s) in the Objective-C SDK:
  1. ParameterTypeRequiredDescription
    includeFieldsPNUserFieldsNoBitfield with names of fields to be returned with the response. Set to PNUserCustomField to return the custom field set by a user create or update request. Omit this property if you do not want to retrieve the additional attributes.
    includeCountBOOLNoSet to YES to return the total number of users included in the paginated response.
    Default is NO.
    limitNSUIntegerNoThe number of users to be returned in the response.
    Default is 100.
    startNSStringNoThe previously-returned cursor bookmark to fetch the next page of results.
    endNSStringNoThe previously-returned cursor bookmark to fetch the previous page of results.
    blockPNFetchUsersCompletionBlockYesFetch all users request completion block.
     
    This method uses the builder pattern, you can remove the arguments which are optional.
self.client.fetchUsers()
    .start(@"<next from previous request>")
    .includeFields(PNUserCustomField)
    .includeCount(YES)
    .limit(40)
    .performWithCompletion(^(PNFetchUsersResult *result, PNErrorStatus *status) {
    if (!status.isError) {
        /**
         * Users successfully fetched.
         * Result object has following information:
         *   result.data.users - list of fetched users
         *   result.data.next - cursor bookmark for fetching the next page.
         *   result.data.prev - cursor bookmark for fetching the previous page
         *   result.data.totalCount - total number of created users
         */
    } else {
        /**
         * Handle users fetch error. Check 'category' property to find out possible issue
         * because of which request did fail.
         *
         * Request can be resent using: [status retry]
         */
    }
});

Response objects which is returned by client when fetch all users Object API is used:

@interface PNFetchUsersData : PNServiceData

// List of user objects created for current subscribe key.
@property (nonatomic, readonly, strong) NSArray<PNUser *> *users;

// Cursor bookmark for fetching the next page.
@property (nonatomic, nullable, readonly, strong) NSString *next;

// Cursor bookmark for fetching the previous page.
@property (nonatomic, nullable, readonly, strong) NSString *prev;

/**
 * Total number of users created for current subscribe key.
 *
 * Value will be 0 in case if 'includeCount' of PNFetchUsersRequest is set to 'NO'.
 */
@property (nonatomic, readonly, assign) NSUInteger totalCount;

@end
 
 
@interface PNFetchUsersResult : PNResult

// Fetch all users request processed information.
@property (nonatomic, readonly, strong) PNFetchUsersData *data;

@end

Error response which is used in case of Objects API call failure:

@interface PNErrorData : PNServiceData

// Stringified error information.
@property (nonatomic, readonly, strong) NSString *information;

@end
 
 
@interface PNErrorStatus : PNStatus

// Whether status object represent error or not.
@property (nonatomic, readonly, assign, getter = isError) BOOL error;

// Additional information related to error status object.
@property (nonatomic, readonly, strong) PNErrorData *errorData;

@end

Returns the specified user object, optionally including the user's custom data object.

To Get User you can use the following method(s) in the Objective-C SDK:
  1. ParameterTypeRequiredDescription
    requestPNFetchUserRequestYesFetch user request with all information which should be used to fetch existing user.
    blockPNFetchUserCompletionBlockYesFetch user request completion block.
    ParameterTypeRequiredDescription
    includeFieldsPNUserFieldsNoBitfield with names of fields to be returned with the response. Set to PNUserCustomField to return the custom field set by a user create or update request. Omit this property if you do not want to retrieve the additional attributes.
    userIdNSStringYesIdentifier of user which should be fetched.
PNFetchUserRequest *request = [PNFetchUserRequest requestWithUserID:@"space-uuid"];
// Add this request option, if returned user model should have value set to 'custom' property.
request.includeFields = PNUserCustomField;

[self.client fetchUserWithRequest:request
                       completion:^(PNFetchUserResult *result, PNErrorStatus *status) {
    if (!status.isError) {
        /**
         * User successfully fetched.
         * Fetched user information available here: result.data.user
         */
    } else {
        /**
         * Handle user fetch error. Check 'category' property to find out possible issue
         * because of which request did fail.
         *
         * Request can be resent using: [status retry]
         */
    }
}];

Response objects which is returned by client when fetch user Object API is used:

@interface PNFetchUserData : PNServiceData

// Requested user object.
@property (nonatomic, nullable, readonly, strong) PNUser *user;

@end
 
 
@interface PNFetchUserResult : PNResult

// Fetch user request processed information.
@property (nonatomic, readonly, strong) PNFetchUserData *data;

@end

Error response which is used in case of Objects API call failure:

@interface PNErrorData : PNServiceData

// Stringified error information.
@property (nonatomic, readonly, strong) NSString *information;

@end
 
 
@interface PNErrorStatus : PNStatus

// Whether status object represent error or not.
@property (nonatomic, readonly, assign, getter = isError) BOOL error;

// Additional information related to error status object.
@property (nonatomic, readonly, strong) PNErrorData *errorData;

@end

Returns the specified user object, optionally including the user's custom data object.

To Get User you can use the following method(s) in the Objective-C SDK:
  1. ParameterTypeRequiredDescription
    userIdNSStringYesIdentifier of user which should be fetched.
    includeFieldsPNUserFieldsNoBitfield with names of fields to be returned with the response. Set to PNUserCustomField to return the custom field set by a user create or update request. Omit this property if you do not want to retrieve the additional attributes.
    blockPNFetchUserCompletionBlockYesFetch user request completion block.
     
    This method uses the builder pattern, you can remove the arguments which are optional.
self.client.fetchUser()
    .userId(@"user-uuid")
    .includeFields(PNUserCustomField)
    .performWithCompletion(^(PNFetchUserResult *result, PNErrorStatus *status) {
        if (!status.isError) {
            /**
             * User successfully fetched.
             * Fetched user information available here: result.data.user
             */
        } else {
            /**
             * Handle user fetch error. Check 'category' property to find out possible issue
             * because of which request did fail.
             *
             * Request can be resent using: [status retry]
             */
        }
    });

Response objects which is returned by client when fetch user Object API is used:

@interface PNFetchUserData : PNServiceData

// Requested user object.
@property (nonatomic, nullable, readonly, strong) PNUser *user;

@end
 
 
@interface PNFetchUserResult : PNResult

// Fetch user request processed information.
@property (nonatomic, readonly, strong) PNFetchUserData *data;

@end

Error response which is used in case of Objects API call failure:

@interface PNErrorData : PNServiceData

// Stringified error information.
@property (nonatomic, readonly, strong) NSString *information;

@end
 
 
@interface PNErrorStatus : PNStatus

// Whether status object represent error or not.
@property (nonatomic, readonly, assign, getter = isError) BOOL error;

// Additional information related to error status object.
@property (nonatomic, readonly, strong) PNErrorData *errorData;

@end

Creates a space with the specified properties. Returns the created space object, optionally including the space's custom data object.

To Create a Space you can use the following method(s) in the Objective-C SDK:
  1. ParameterTypeRequiredDescription
    requestPNCreateSpaceRequestYesCreate space request with all information about new space which will be passed to PubNub service.
    blockPNCreateSpaceCompletionBlockNoCreate space request completion block.
    ParameterTypeRequiredDescription
    includeFieldsPNSpaceFieldsNoBitfield with names of fields to be returned with the response. Set to PNSpaceCustomField to return the custom field set by a user create or update request. Omit this property if you do not want to retrieve the additional attributes.
    informationNSStringNoSpace description information.
    customNSDictionaryNoAdditional / complex attributes which should be associated to space with specified spaceId.
    nameNSStringYesName which should be associated with new space entry.
PNCreateSpaceRequest *request = [PNCreateSpaceRequest requestWithSpaceID:@"space-uuid"
                                                                    name:@"Admin"];
request.information = @"Administrative space";
request.custom = @{ @"responsibilities": @"Manage access to protected resources" };

[self.client createSpaceWithRequest:request completion:^(PNCreateSpaceStatus *status) {
    if (!status.isError) {
        /**
         * Space successfully created.
         * Created space information available here: status.data.space
         */
    } else {
        /**
         * Handle space create error. Check 'category' property to find out possible issue
         * because of which request did fail.
         *
         * Request can be resent using: [status retry]
         */
    }
}];

Response objects which is returned by client when create space Object API is used:

@interface PNCreateSpaceData : PNServiceData

// Created space object.
@property (nonatomic, nullable, readonly, strong) PNSpace *space;

@end
 
 
@interface PNCreateSpaceStatus : PNAcknowledgmentStatus

// Create space request processed information.
@property (nonatomic, readonly, strong) PNCreateSpaceData *data;

@end

Creates a space with the specified properties. Returns the created space object, optionally including the space's custom data object.

To Create a Space you can use the following method(s) in the Objective-C SDK:
  1. ParameterTypeRequiredDescription
    spaceIdNSStringYesUnique identifier for new space entry.
    nameNSStringYesName which should be associated with new space entry.
    informationNSStringNoSpace description information.
    customNSDictionaryNoAdditional / complex attributes which should be associated to space with specified spaceId.
    includeFieldsPNSpaceFieldsNo Bitfield with names of fields to be returned with the response. Set to PNSpaceCustomField to return the custom field set by a space create or update request. Omit this property if you do not want to retrieve the additional attributes.
    blockPNCreateSpaceCompletionBlockNoCreate space request completion block.
     
    This method uses the builder pattern, you can remove the arguments which are optional.
self.client.createSpace()
    .spaceId(@"space-uuid")
    .name(@"Admin")
    .information(@"Administrative space")
    .custom(@{ @"responsibilities": @"Manage access to protected resources" })
    .includeFields(PNSpaceCustomField)
    .performWithCompletion(^(PNCreateSpaceStatus *status) {
        if (!status.isError) {
            /**
             * Space successfully created.
             * Created space information available here: status.data.space
             */
        } else {
            /**
             * Handle space create error. Check 'category' property to find out possible issue
             * because of which request did fail.
             *
             * Request can be resent using: [status retry]
             */
        }
    });

Response objects which is returned by client when create space Object API is used:

@interface PNCreateSpaceData : PNServiceData

// Created space object.
@property (nonatomic, nullable, readonly, strong) PNSpace *space;

@end
 
 
@interface PNCreateSpaceStatus : PNAcknowledgmentStatus

// Create space request processed information.
@property (nonatomic, readonly, strong) PNCreateSpaceData *data;

@end

Updates a space with the specified properties. Returns the updated space object, optionally including the space's custom data object.

To Update a Space you can use the following method(s) in the Objective-C SDK:
  1. ParameterTypeRequiredDescription
    requestPNUpdateSpaceRequestYesUpdate space request with all information which should be updated for existing space.
    blockPNUpdateSpaceCompletionBlockNoUpdate space request completion block.
    ParameterTypeRequiredDescription
    includeFieldsPNSpaceFieldsNoBitfield with names of fields to be returned with the response. Set to PNSpaceCustomField to return the custom field set by a space create or update request. Omit this property if you do not want to retrieve the additional attributes.
    informationNSStringNoSpace description information.
    customNSDictionaryNoAdditional / complex attributes which should be associated to space with specified spaceId.
    Partial update not available, whole object from previous create / update with changes should be passed.
    nameNSStringNoName which should be associated with space entry.
    Name can't be empty or nil.
PNUpdateSpaceRequest *request = [PNUpdateSpaceRequest requestWithSpaceID:@"space-uuid"];
// Add this request option, if returned space model should have value set to 'custom' property.
request.includeFields = PNSpaceCustomField;
request.custom = @{ @"responsibilities": @"Manage tests", @"status": @"offline" };
request.name = @"Updated space name";

[self.client updateSpaceWithRequest:request completion:^(PNUpdateSpaceStatus *status) {
    if (!status.isError) {
        /**
         * Space successfully updated.
         * Updated space information available here: status.data.space
         */
    } else {
        /**
         * Handle space update error. Check 'category' property to find out possible issue
         * because of which request did fail.
         *
         * Request can be resent using: [status retry]
         */
    }
}];

Response objects which is returned by client when update space Object API is used:

@interface PNUpdateSpaceData : PNServiceData

// Updated space object.
@property (nonatomic, nullable, readonly, strong) PNSpace *space;

@end
 
 
@interface PNUpdateSpaceStatus : PNAcknowledgmentStatus

// Update space request processed information.
@property (nonatomic, readonly, strong) PNUpdateSpaceData *data;

@end

Updates a space with the specified properties. Returns the updated space object, optionally including the space's custom data object.

To Update a Space you can use the following method(s) in the Objective-C SDK:
  1. ParameterTypeRequiredDescription
    spaceIdNSStringYesIdentifier of space which should be updated.
    nameNSStringNoName which should be associated with space entry.
    Name can't be empty or nil.
    informationNSStringNoSpace description information.
    customNSDictionaryNoAdditional / complex attributes which should be associated to space with specified spaceId.
    Partial update not available, whole object from previous create / update with changes should be passed.
    includeFieldsPNSpaceFieldsNoBitfield with names of fields to be returned with the response. Set to PNSpaceCustomField to return the custom field set by a space create or update request. Omit this property if you do not want to retrieve the additional attributes.
    blockPNUpdateSpaceCompletionBlockNoUpdate space request completion block.
     
    This method uses the builder pattern, you can remove the arguments which are optional.
self.client.updateSpace()
    .spaceId(@"space-uuid")
    .name(@"Updated space name")
    .custom(@{ @"responsibilities": @"Manage tests", @"status": @"offline" })
    .includeFields(PNSpaceCustomField)
    .performWithCompletion(^(PNUpdateSpaceStatus *status) {
        if (!status.isError) {
            /**
             * Space successfully updated.
             * Updated space information available here: status.data.space
             */
        } else {
            /**
             * Handle space update error. Check 'category' property to find out possible issue
             * because of which request did fail.
             *
             * Request can be resent using: [status retry]
             */
        }
    });

Response objects which is returned by client when update space Object API is used:

@interface PNUpdateSpaceData : PNServiceData

// Updated space object.
@property (nonatomic, nullable, readonly, strong) PNSpace *space;

@end
 
 
@interface PNUpdateSpaceStatus : PNAcknowledgmentStatus

// Update space request processed information.
@property (nonatomic, readonly, strong) PNUpdateSpaceData *data;

@end

Deletes the specified space object.

To Delete a Space you can use the following method(s) in the Objective-C SDK:
  1. ParameterTypeRequiredDescription
    requestPNDeleteSpaceRequestYesDelete space request with information about existing space.
    blockPNDeleteSpaceCompletionBlockNoDelete space request completion block.
    ParameterTypeRequiredDescription
    spaceIdNSStringYesIdentifier of space which should be removed.
PNDeleteSpaceRequest *request = [PNDeleteSpaceRequest requestWithSpaceID:@"space-uuid"];

[self.client deleteSpaceWithRequest:request completion:^(PNAcknowledgmentStatus *status) {
    if (!status.isError) {
        // Space successfully deleted.
    } else {
        /**
         * Handle space delete error. Check 'category' property to find out possible issue
         * because of which request did fail.
         *
         * Request can be resent using: [status retry]
         */
    }
}];

Response objects which is returned by client when delete space Object API is used:

@interface PNErrorData : PNServiceData

// Stringified error information.
@property (nonatomic, readonly, strong) NSString *information;

@end

 
@interface PNAcknowledgmentStatus : PNErrorStatus

// Whether status object represent error or not.
@property (nonatomic, readonly, assign, getter = isError) BOOL error;

// Additional information related to error status object.
@property (nonatomic, readonly, strong) PNErrorData *errorData;

@end

Deletes the specified space object.

To Delete a Space you can use the following method(s) in the Objective-C SDK:
  1. ParameterTypeRequiredDescription
    spaceIdNSStringYesIdentifier of space which should be removed.
    blockPNDeleteSpaceCompletionBlockNoDelete space request completion block.
self.client.deleteSpace()
    .spaceId(@"space-uuid")
    .performWithCompletion(^(PNAcknowledgmentStatus *status) {
        if (!status.isError) {
             // Space successfully deleted.
        } else {
            /**
             * Handle space delete error. Check 'category' property to find out possible issue
             * because of which request did fail.
             *
             * Request can be resent using: [status retry]
             */
        }
    });

Response objects which is returned by client when delete space Object API is used:

@interface PNErrorData : PNServiceData

// Stringified error information.
@property (nonatomic, readonly, strong) NSString *information;

@end

 
@interface PNAcknowledgmentStatus : PNErrorStatus

// Whether status object represent error or not.
@property (nonatomic, readonly, assign, getter = isError) BOOL error;

// Additional information related to error status object.
@property (nonatomic, readonly, strong) PNErrorData *errorData;

@end

Returns the paginated list of space objects, optionally including the space's custom data object.

To Get Spaces you can use the following method(s) in the Objective-C SDK:
  1. ParameterTypeRequiredDescription
    requestPNFetchSpacesRequestYesFetch all spaces request object with all information which should be used to fetch existing spaces.
    blockPNFetchSpaceCompletionBlockYesFetch all spaces request completion block.
    ParameterTypeRequiredDescription
    includeFieldsPNSpaceFieldsNoBitfield with names of fields to be returned with the response. Set to PNSpaceCustomField to return the custom field set by a space create or update request. Omit this property if you do not want to retrieve the additional attributes.
    includeCountBOOLNoSet to YES to return the total number of spaces included in the paginated response.
    Default is NO.
    startNSStringNoThe previously-returned cursor bookmark to fetch the next page of results.
    endNSStringNoThe previously-returned cursor bookmark to fetch the previous page of results.
    limitNSUIntegerNoThe number of spaces to be returned in the response. Default is 100.
PNFetchSpacesRequest *request = [PNFetchSpacesRequest new];
request.start = @"<next from previous request>";
// Add this request option, if returned space models should have value set to 'custom' property.
request.includeFields = PNSpaceCustomField;
request.includeCount = YES;
request.limit = 40;

[self.client fetchSpacesWithRequest:request
                        completion:^(PNFetchSpacesResult *result, PNErrorStatus *status) {
    if (!status.isError) {
        /**
         * Spaces successfully fetched.
         * Result object has following information:
         *   result.data.spaces - list of fetched spaces
         *   result.data.next - cursor bookmark for fetching the next page.
         *   result.data.prev - cursor bookmark for fetching the previous page
         *   result.data.totalCount - total number of created spaces
         */
    } else {
        /**
         * Handle spaces fetch error. Check 'category' property to find out possible issue
         * because of which request did fail.
         *
         * Request can be resent using: [status retry]
         */
    }
}];

Response objects which is returned by client when fetch all spaces Object API is used:

@interface PNFetchSpacesData : PNServiceData

// List of space objects created for current subscribe key.
@property (nonatomic, readonly, strong) NSArray<PNSpace *> *spaces;

// Cursor bookmark for fetching the next page.
@property (nonatomic, nullable, readonly, strong) NSString *next;

// Cursor bookmark for fetching the previous page.
@property (nonatomic, nullable, readonly, strong) NSString *prev;

/**
 * Total number of spaces created for current subscribe key.
 *
 * Value will be 0 in case if 'includeCount' of PNFetchSpacesRequest is set to 'NO'.
 */
@property (nonatomic, readonly, assign) NSUInteger totalCount;

@end
 
 
@interface PNFetchSpacesResult : PNResult

// Fetch all spaces request processed information.
@property (nonatomic, readonly, strong) PNFetchSpacesData *data;

@end

Error response which is used in case of Objects API call failure:

@interface PNErrorData : PNServiceData

// Stringified error information.
@property (nonatomic, readonly, strong) NSString *information;

@end
 
 
@interface PNErrorStatus : PNStatus

// Whether status object represent error or not.
@property (nonatomic, readonly, assign, getter = isError) BOOL error;

// Additional information related to error status object.
@property (nonatomic, readonly, strong) PNErrorData *errorData;

@end

Returns the paginated list of space objects, optionally including the space's custom data object.

To Get Spaces you can use the following method(s) in the Objective-C SDK:
  1. ParameterTypeRequiredDescription
    includeFieldsPNSpaceFieldsNoBitfield with names of fields to be returned with the response. Set to PNSpaceCustomField to return the custom field set by a space create or update request. Omit this property if you do not want to retrieve the additional attributes.
    includeCountBOOLNoSet to YES to return the total number of spaces included in the paginated response.
    Default is NO.
    limitNSUIntegerNoThe number of spaces to be returned in the response. Default is 100.
    startNSStringNoThe previously-returned cursor bookmark to fetch the next page of results.
    endNSStringNoThe previously-returned cursor bookmark to fetch the previous page of results.
    blockPNFetchSpacesCompletionBlockYesFetch all spaces request completion block.
     
    This method uses the builder pattern, you can remove the arguments which are optional.
self.client.fetchSpaces()
    .start(@"<next from previous request>")
    .includeFields(PNSpaceCustomField)
    .includeCount(YES)
    .limit(40)
    .performWithCompletion(^(PNFetchSpacesResult *result, PNErrorStatus *status) {
    if (!status.isError) {
        /**
         * Spaces successfully fetched.
         * Result object has following information:
         *   result.data.spaces - list of fetched spaces
         *   result.data.next - cursor bookmark for fetching the next page.
         *   result.data.prev - cursor bookmark for fetching the previous page
         *   result.data.totalCount - total number of created spaces
         */
    } else {
        /**
         * Handle spaces fetch error. Check 'category' property to find out possible issue
         * because of which request did fail.
         *
         * Request can be resent using: [status retry]
         */
    }
});

Response objects which is returned by client when fetch all spaces Object API is used:

@interface PNFetchSpacesData : PNServiceData

// List of space objects created for current subscribe key.
@property (nonatomic, readonly, strong) NSArray<PNSpace *> *spaces;

// Cursor bookmark for fetching the next page.
@property (nonatomic, nullable, readonly, strong) NSString *next;

// Cursor bookmark for fetching the previous page.
@property (nonatomic, nullable, readonly, strong) NSString *prev;

/**
 * Total number of spaces created for current subscribe key.
 *
 * Value will be 0 in case if 'includeCount' of PNFetchSpacesRequest is set to 'NO'.
 */
@property (nonatomic, readonly, assign) NSUInteger totalCount;

@end
 
 
@interface PNFetchSpacesResult : PNResult

// Fetch all spaces request processed information.
@property (nonatomic, readonly, strong) PNFetchSpacesData *data;

@end

Error response which is used in case of Objects API call failure:

@interface PNErrorData : PNServiceData

// Stringified error information.
@property (nonatomic, readonly, strong) NSString *information;

@end
 
 
@interface PNErrorStatus : PNStatus

// Whether status object represent error or not.
@property (nonatomic, readonly, assign, getter = isError) BOOL error;

// Additional information related to error status object.
@property (nonatomic, readonly, strong) PNErrorData *errorData;

@end

Returns the specified space object, optionally including the space's custom data object.

To Get a Space you can use the following method(s) in the Objective-C SDK:
  1. ParameterTypeRequiredDescription
    requestPNFetchSpaceRequestYesFetch space request with all information which should be used to fetch existing space.
    blockPNFetchSpaceCompletionBlockYesFetch space request completion block.
    ParameterTypeRequiredDescription
    includeFieldsPNSpaceFieldsYesBitfield with names of fields to be returned with the response. Set to PNSpaceCustomField to return the custom field set by a space create or update request. Omit this property if you do not want to retrieve the additional attributes.
    spaceIdNSStringYesIdentifier of space which should be fetched.
PNFetchSpaceRequest *request = [PNFetchSpaceRequest requestWithSpaceID:@"space-uuid"];
// Add this request option, if returned space model should have value set to 'custom' property.
request.includeFields = PNSpaceCustomField;

[self.client fetchSpaceWithRequest:request
                       completion:^(PNFetchSpaceResult *result, PNErrorStatus *status) {
    if (!status.isError) {
        /**
         * Space successfully fetched.
         * Fetched space information available here: result.data.space
         */
    } else {
        /**
         * Handle space fetch error. Check 'category' property to find out possible issue
         * because of which request did fail.
         *
         * Request can be resent using: [status retry]
         */
    }
}];

Response objects which is returned by client when fetch space Object API is used:

@interface PNFetchSpaceData : PNServiceData

// Requested space object.
@property (nonatomic, nullable, readonly, strong) PNSpace *space;

@end
 
 
@interface PNFetchSpaceResult : PNResult

// Fetch space request processed information.
@property (nonatomic, readonly, strong) PNFetchSpaceData *data;

@end

Error response which is used in case of Objects API call failure:

@interface PNErrorData : PNServiceData

// Stringified error information.
@property (nonatomic, readonly, strong) NSString *information;

@end
 
 
@interface PNErrorStatus : PNStatus

// Whether status object represent error or not.
@property (nonatomic, readonly, assign, getter = isError) BOOL error;

// Additional information related to error status object.
@property (nonatomic, readonly, strong) PNErrorData *errorData;

@end

Returns the specified space object, optionally including the space's custom data object.

To Get a Space you can use the following method(s) in the Objective-C SDK:
  1. ParameterTypeRequiredDescription
    spaceIdNSStringYesIdentifier of space which should be fetched.
    includeFieldsPNSpaceFieldsNoBitfield with names of fields to be returned with the response. Set to PNSpaceCustomField to return the custom field set by a space create or update request. Omit this property if you do not want to retrieve the additional attributes.
    blockPNFetchSpaceCompletionBlockYesFetch space request completion block.
     
    This method uses the builder pattern, you can remove the arguments which are optional.
self.client.fetchSpace()
    .spaceId(@"space-uuid")
    .includeFields(PNSpaceCustomField)
    .performWithCompletion(^(PNFetchSpaceResult *result, PNErrorStatus *status) {
        if (!status.isError) {
            /**
             * Space successfully fetched.
             * Fetched space information available here: result.data.space
             */
        } else {
            /**
             * Handle space fetch error. Check 'category' property to find out possible issue
             * because of which request did fail.
             *
             * Request can be resent using: [status retry]
             */
        }
    });

Response objects which is returned by client when fetch space Object API is used:

@interface PNFetchSpaceData : PNServiceData

// Requested space object.
@property (nonatomic, nullable, readonly, strong) PNSpace *space;

@end
 
 
@interface PNFetchSpaceResult : PNResult

// Fetch space request processed information.
@property (nonatomic, readonly, strong) PNFetchSpaceData *data;

@end

Error response which is used in case of Objects API call failure:

@interface PNErrorData : PNServiceData

// Stringified error information.
@property (nonatomic, readonly, strong) NSString *information;

@end
 
 
@interface PNErrorStatus : PNStatus

// Whether status object represent error or not.
@property (nonatomic, readonly, assign, getter = isError) BOOL error;

// Additional information related to error status object.
@property (nonatomic, readonly, strong) PNErrorData *errorData;

@end

Get the specified user's space memberships.

To Get Memberships you can use the following method(s) in the Objective-C SDK:
  1. ParameterTypeRequiredDescription
    requestPNFetchMembershipsRequestYesFetch user's memberships request with all information which should be used to fetch existing user's memberships.
    blockPNFetchMembershipsCompletionBlockYesFetch user's memberships request completion block.
    ParameterTypeRequiredDescription
    includeFieldsPNMembershipFieldsNoBitfield set to fields which should be returned with response.
    • PNMembershipCustomField field with additional information which has been associated with user during membership create / update requests.
    • PNMembershipSpaceField - field with space's information (not only spaceId).
    • PNMembershipSpaceCustomField - field with additional information which has been used during space create / update requests.

    Omit this property if you don't want to retrieve additional attributes.
    includeCountBOOLNoSet to YES to return the total number of memberships included in the paginated response.
    Default is NO.
    startNSStringNoThe previously-returned cursor bookmark to fetch the next page of results.
    endNSStringNoThe previously-returned cursor bookmark to fetch the previous page of results.
    limitNSUIntegerNoThe number of memberships to be returned in the response.
    Default is 100.
    userIdNSStringYesIdentifier of user for which memberships in spaces should be fetched.
PNFetchMembershipsRequest *request = [PNFetchMembershipsRequest requestWithUserID:@"used-uuid"];
request.start = @"<next from previous request>";
// Add this request option, if returned membership models should have value set to 'custom'
// and 'space' properties.
request.includeFields = PNMembershipCustomField|PNMembershipSpaceField;
request.includeCount = YES;
request.limit = 40;

[self.client fetchMembershipsWithRequest:request
                          completion:^(PNFetchMembershipsResult *result, PNErrorStatus *status) {
    if (!status.isError) {
        /**
         * User's memberships successfully fetched.
         * Result object has following information:
         *   result.data.memberships - list of user's memberships
         *   result.data.next - cursor bookmark for fetching the next page
         *   result.data.prev - cursor bookmark for fetching the previous page
         *   result.data.totalCount - total number of user's memberships
         */
    } else {
        /**
         * Handle user's memberships fetch error. Check 'category' property to find out possible
         * issue because of which request did fail.
         *
         * Request can be resent using: [status retry]
         */
    }
}];

Response objects which is returned by client when fetch memberships Object API is used:

@interface PNFetchMembershipsData : PNServiceData

// List of fetched memberships.
@property (nonatomic, readonly, strong) NSArray<PNMembership *> *memberships;

// Cursor bookmark for fetching the next page.
@property (nonatomic, nullable, readonly, strong) NSString *next;

// Cursor bookmark for fetching the previous page.
@property (nonatomic, nullable, readonly, strong) NSString *prev;

/**
 * Total number of users created for current subscribe key.
 *
 * Value will be 0 in case if 'includeCount' of PNFetchMembershipsRequest is set to 'NO'.
 */
@property (nonatomic, readonly, assign) NSUInteger totalCount;

@end
 
 
@interface PNFetchMembershipsResult : PNAcknowledgmentStatus

// Fetch memberships request processed information.
@property (nonatomic, readonly, strong) PNFetchMembershipsData *data;

@end

Get the specified user's space memberships.

To Get Memberships you can use the following method(s) in the Objective-C SDK:
  1. ParameterTypeRequiredDescription
    userIdNSStringYesIdentifier of user for which memberships in spaces should be fetched.
    includeFieldsPNMembershipFieldsNo
    • PNMembershipCustomField - field with additional information which has been associated with user during membership create / update requests.
    • PNMembershipSpaceField - field with space's information (not only spaceId).
    • PNMembershipSpaceCustomField - field with additional information which has been used during space create / update requests.
    includeCountBOOLNoSet to YES to return the total number of memberships included in the paginated response.
    Default is NO.
    limitNSUIntegerNoThe number of memberships to be returned in the response.
    Default is 100.
    startNSStringNoThe previously-returned cursor bookmark to fetch the next page of results.
    endNSStringNoThe previously-returned cursor bookmark to fetch the previous page of results.
    blockPNFetchMembershipsCompletionBlockNoFetch user's memberships request completion block.
     
    This method uses the builder pattern, you can remove the arguments which are optional.
self.client.fetchMemberships()
    .userId(@"user-uuid")
    .includeCount(YES)
    .limit(40)
    .includeFields(PNMembershipCustomField|PNMembershipSpaceField)
    .performWithCompletion(^(PNFetchMembershipsResult *result, PNErrorStatus *status) {
        if (!status.isError) {
            /**
             * User's memberships successfully fetched.
             * Result object has following information:
             *   result.data.memberships - list of user's memberships
             *   result.data.next - cursor bookmark for fetching the next page
             *   result.data.prev - cursor bookmark for fetching the previous page
             *   result.data.totalCount - total number of user's memberships
             */
        } else {
            /**
             * Handle user's memberships fetch error. Check 'category' property to find out possible
             * issue because of which request did fail.
             *
             * Request can be resent using: [status retry]
             */
        }
    });

Response objects which is returned by client when fetch memberships Object API is used:

@interface PNFetchMembershipsData : PNServiceData

// List of fetched memberships.
@property (nonatomic, readonly, strong) NSArray<PNMembership *> *memberships;

// Cursor bookmark for fetching the next page.
@property (nonatomic, nullable, readonly, strong) NSString *next;

// Cursor bookmark for fetching the previous page.
@property (nonatomic, nullable, readonly, strong) NSString *prev;

/**
 * Total number of users created for current subscribe key.
 *
 * Value will be 0 in case if 'includeCount' of PNFetchMembershipsRequest is set to 'NO'.
 */
@property (nonatomic, readonly, assign) NSUInteger totalCount;

@end
 
 
@interface PNFetchMembershipsResult : PNAcknowledgmentStatus

// Fetch memberships request processed information.
@property (nonatomic, readonly, strong) PNFetchMembershipsData *data;

@end

Error resonse which is used in case of Objects API call failure:

@interface PNErrorData : PNServiceData

// Stringified error information.
@property (nonatomic, readonly, strong) NSString *information;

@end
 
@interface PNErrorStatus : PNStatus

// Whether status object represent error or not.
@property (nonatomic, readonly, assign, getter = isError) BOOL error;

// Additional information related to error status object.
@property (nonatomic, readonly, strong) PNErrorData *errorData;

@end

Get the specified space’s member users.

To Get Members you can use the following method(s) in the Objective-C SDK:
  1. ParameterTypeRequiredDescription
    requestPNFetchMembersRequestYesFetch space's members request with all information which should be used to fetch existing space's members.
    blockPNFetchMembersCompletionBlockYesFetch space's members request completion block.
    ParameterTypeRequiredDescription
    includeFieldsPNMemberFieldsNoBitfield set to fields which should be returned with response.
    • PNMemberCustomField - field with additional information which has been associated with user during add / update space's users list requests.
    • PNMemberUserField - field with user's information (not only userId).
    • PNMemberUserCustomField - field with additional information which has been used during user create / update requests.

    Omit this property if you don't want to retrieve additional attributes.
    includeCountBOOLNoSet to YES to return the total number of members included in the paginated response.
    Default is NO.
    startNSStringNoThe previously-returned cursor bookmark to fetch the next page of results.
    endNSStringNoThe previously-returned cursor bookmark to fetch the previous page of results.
    limitNSUIntegerNoThe number of members to be returned in the response.
    Default is 100.
    spaceIdNSStringYesIdentifier of space for which members list should be fetched.
PNFetchMembersRequest *request = [PNFetchMembersRequest requestWithSpaceID:@"space-uuid"];
request.start = @"<next from previous request>";
// Add this request option, if returned member models should have value set to 'custom' and
// 'user' properties.
request.includeFields = PNMemberCustomField|PNMemberUserField;
request.includeCount = YES;
request.limit = 40;

[self.client fetchMembersWithRequest:request
                              completion:^(PNFetchMembersResult *result, PNErrorStatus *status) {
    if (!status.isError) {
        /**
         * Space's members successfully fetched.
         * Result object has following information:
         *   result.data.members - list of space's members
         *   result.data.next - cursor bookmark for fetching the next page
         *   result.data.prev - cursor bookmark for fetching the previous page
         *   result.data.totalCount - total number of space's members
         */
    } else {
        /**
         * Handle space's members fetch error. Check 'category' property to find out possible
         * issue because of which request did fail.
         *
         * Request can be resent using: [status retry]
         */
    }
}];

Response objects which is returned by client when fetch members Object API is used:

@interface PNFetchMembersData : PNServiceData

// List of fetched members.
@property (nonatomic, readonly, strong) NSArray<PNMember *> *member;

// Cursor bookmark for fetching the next page.
@property (nonatomic, nullable, readonly, strong) NSString *next;

// Cursor bookmark for fetching the previous page.
@property (nonatomic, nullable, readonly, strong) NSString *prev;

/**
 * Total number of members created for current subscribe key.
 *
 * Value will be 0 in case if 'includeCount' of PNFetchMembersRequest is set to 'NO'.
 */
@property (nonatomic, readonly, assign) NSUInteger totalCount;

@end
 
 
@interface PNFetchMembersResult : PNAcknowledgmentStatus

// Fetch members request processed information.
@property (nonatomic, readonly, strong) PNFetchMembersData *data;

@end

Error response which is used in case of Objects API call failure:

@interface PNErrorData : PNServiceData

// Stringified error information.
@property (nonatomic, readonly, strong) NSString *information;

@end
 
@interface PNErrorStatus : PNStatus

// Whether status object represent error or not.
@property (nonatomic, readonly, assign, getter = isError) BOOL error;

// Additional information related to error status object.
@property (nonatomic, readonly, strong) PNErrorData *errorData;

@end

Get the specified space’s member users.

To Get Members you can use the following method(s) in the Objective-C SDK:
  1. ParameterTypeRequiredDescription
    spaceIdNSStringYesIdentifier of space for which list of members will be fetched.
    includeFieldsPNMemberFieldsNo
    • PNMemberCustomField - field with additional information which has been associated with user during add / update space's users list requests.
    • PNMemberUserField - field with user's information (not only userId).
    • PNMemberUserCustomField - field with additional information which has been used during user create / update requests.
    includeCountBOOLNoSet to YES to return the total number of members included in the paginated response.
    Default is NO.
    limitNSUIntegerNoThe number of members to be returned in the response.
    Default is 100.
    startNSStringNoThe previously-returned cursor bookmark to fetch the next page of results.
    endNSStringNoThe previously-returned cursor bookmark to fetch the previous page of results.
    blockPNFetchMembersCompletionBlockYesFetch space's members request completion block.
     
    This method uses the builder pattern, you can remove the arguments which are optional.
self.client.fetchMembers()
    .spaceId(@"space-uuid")
    .includeCount(YES)
    .limit(40)
    .includeFields(PNMemberCustomField|PNMemberUserField)
    .performWithCompletion(^(PNFetchMembersResult *result, PNErrorStatus *status) {
      if (!status.isError) {
          /**
           * Space's members successfully fetched.
           * Result object has following information:
           *   result.data.members - list of space's members
           *   result.data.next - cursor bookmark for fetching the next page
           *   result.data.prev - cursor bookmark for fetching the previous page
           *   result.data.totalCount - total number of space's members
           */
      } else {
          /**
           * Handle space's members fetch error. Check 'category' property to find out possible
           * issue because of which request did fail.
           *
           * Request can be resent using: [status retry]
           */
      }
});

Response objects which is returned by client when fetch members Object API is used:

@interface PNFetchMembersData : PNServiceData

// List of fetched members.
@property (nonatomic, readonly, strong) NSArray<PNMember *> *member;

// Cursor bookmark for fetching the next page.
@property (nonatomic, nullable, readonly, strong) NSString *next;

// Cursor bookmark for fetching the previous page.
@property (nonatomic, nullable, readonly, strong) NSString *prev;

/**
 * Total number of members created for current subscribe key.
 *
 * Value will be 0 in case if 'includeCount' of PNFetchMembersRequest is set to 'NO'.
 */
@property (nonatomic, readonly, assign) NSUInteger totalCount;

@end
 
 
@interface PNFetchMembersResult : PNAcknowledgmentStatus

// Fetch members request processed information.
@property (nonatomic, readonly, strong) PNFetchMembersData *data;

@end

Error response which is used in case of Objects API call failure:

@interface PNErrorData : PNServiceData

// Stringified error information.
@property (nonatomic, readonly, strong) NSString *information;

@end
 
@interface PNErrorStatus : PNStatus

// Whether status object represent error or not.
@property (nonatomic, readonly, assign, getter = isError) BOOL error;

// Additional information related to error status object.
@property (nonatomic, readonly, strong) PNErrorData *errorData;

@end

Manage the specified user's memberships. You can Add, Remove, and Update a user's memberships.

To Manage Memberships you can use the following method(s) in the Objective-C SDK:
  1. ParameterTypeRequiredDescription
    requestPNManageMembershipsRequestYesManage user's memberships request with information what modifications to user's memberships should be done (join / update / leave spaces).
    blockPNManageMembershipsCompletionBlockNoManage user's memberships request completion block.
    ParameterTypeRequiredDescription
    includeFieldsPNMembershipFieldsNoBitfield set to fields which should be returned with response.
    • PNMembershipCustomField - field with additional information which has been associated with user during membership create / update requests.
    • PNMembershipSpaceField - field with space's information (not only spaceId).
    • PNMembershipSpaceCustomField - field with additional information which has been used during space create / update requests.

    Omit this property if you don't want to retrieve additional attributes.
    joinSpacesNSArrayNoList of spaces to which user should join.
    Each entry is dictionary with spaceId and optional custom fields. custom should be dictionary with simple objects: NSString and NSNumber.
    updateSpacesNSArrayNoList of spaces for which additional information associated with user should be updated.
    Each entry is dictionary with spaceId and optional custom fields. custom should be dictionary with simple objects: NSString and NSNumber.
    leaveSpacesNSArrayNoList of (their identifiers) which user should leave.
    includeCountBOOLNoSet to YES to return the total number of memberships included in the paginated response.
    Default is NO.
    startNSStringNoThe previously-returned cursor bookmark to fetch the next page of results.
    endNSStringNoThe previously-returned cursor bookmark to fetch the previous page of results.
    limitNSUIntegerNoThe number of memberships to be returned in the response.
    Default is 100.
    userIdNSStringYesIdentifier of user for which memberships should be managed.
PNManageMembershipsRequest *request = [PNManageMembershipsRequest requestWithUserID:@"used-uuid"];
request.updateSpaces = @[
    @{ @"spaceId": @"space2-uuid", @"custom": @{ @"role": @"moderator" } }
];
request.leaveSpaces = @[@"space3-uuid", @"space4-uuid"];
request.joinSpaces = @[
    @{ @"spaceId": @"space1-uuid", @"custom": @{ @"role": @"owner" } }
];
// Add this request option, if returned membership models should have value set to 'custom'
// and 'space' properties.
request.includeFields = PNMembershipCustomField|PNMembershipSpaceField;
request.includeCount = YES;
request.limit = 40;

[self.client manageMembershipsWithRequest:request
                               completion:^(PNManageMembershipsStatus *status) {
    if (!status.isError) {
        /**
         * User's memberships successfully updated.
         * Result object has following information:
         *   status.data.memberships - list of user's created / updated memberships
         *   status.data.next - cursor bookmark for fetching the next page
         *   status.data.prev - cursor bookmark for fetching the previous page
         *   status.data.totalCount - total number of user's memberships
         */
    } else {
        /**
         * Handle user's memberships update error. Check 'category' property to find out possible
         * issue because of which request did fail.
         *
         * Request can be resent using: [status retry]
         */
    }
}];

Response objects which is returned by client when manage memberships Object API is used:

@interface PNManageMembershipsData : PNServiceData

// List of updated memberships.
@property (nonatomic, readonly, strong) NSArray<PNMembership *> *memberships;

// Cursor bookmark for fetching the next page.
@property (nonatomic, nullable, readonly, strong) NSString *next;

// Cursor bookmark for fetching the previous page.
@property (nonatomic, nullable, readonly, strong) NSString *prev;

/**
 * Total number of users created for current subscribe key.
 *
 * Value will be 0 in case if 'includeCount' of PNManageMembershipsRequest is set to 'NO'.
 */
@property (nonatomic, readonly, assign) NSUInteger totalCount;

@end
 
 
@interface PNManageMembershipsStatus : PNAcknowledgmentStatus

// Manage memberships request processed information.
@property (nonatomic, readonly, strong) PNManageMembershipsData *data;

@end

Updates the specified user's memberships. You can Add, Remove, and Update a user's memberships.

To Update Memberships you can use the following method(s) in the Objective-C SDK:
  1. ParameterTypeRequiredDescription
    userIdNSStringYesIdentifier of user for which memberships should be managed.
    addNSArrayNoList of spaces which should be added to user's memberships.
    Each entry is dictionary with spaceId and optional custom fields. custom should be dictionary with simple objects: NSString and NSNumber.
    updateNSArrayNoList of spaces for which additional information associated with userId should be updated.
    Each entry is dictionary with spaceId and optional custom fields. custom should be dictionary with simple objects: NSString and NSNumber.
    removeNSArrayNoList of spaces (their identifiers) which should be removed from user's memberships.
    includeFieldsPNMemberFieldsNo
    • PNMembershipCustomField - field with additional information which has been associated with user during membership create / update requests.
    • PNMembershipSpaceField - field with space's information (not only spaceId).
    • PNMembershipSpaceCustomField - field with additional information which has been used during space create / update requests.
    includeCountBOOLNoSet to YES to return the total number of memberships included in the paginated response.
    Default is NO.
    limitNSUIntegerNoThe number of memberships to be returned in the response.
    Default is 100.
    startNSStringNoThe previously-returned cursor bookmark to fetch the next page of results.
    endNSStringNoThe previously-returned cursor bookmark to fetch the previous page of results.
    blockPNManageMembershipsCompletionBlockNoManage user's memberships request completion block.
     
    This method uses the builder pattern, you can remove the arguments which are optional.
self.client.manageMemberships()
    .userId(@"user-uuid")
    .update(@[
        @{ @"spaceId": @"space2-uuid", @"custom": @{ @"role": @"moderator" } }
    ])
    .remove(@[@"space3-uuid", @"space4-uuid"])
    .add(@[
        @{ @"spaceId": @"space1-uuid", @"custom": @{ @"role": @"owner" } }
    ])
    .includeCount(YES)
    .limit(40)
    .includeFields(PNMembershipCustomField|PNMembershipSpaceField)
    .performWithCompletion(^(PNManageMembershipsStatus *status) {
        if (!status.isError) {
            /**
             * User's memberships successfully updated.
             * Result object has following information:
             *   status.data.memberships - list of user's created / updated memberships
             *   status.data.next - cursor bookmark for fetching the next page
             *   status.data.prev - cursor bookmark for fetching the previous page
             *   status.data.totalCount - total number of user's memberships
             */
        } else {
            /**
             * Handle user's memberships update error. Check 'category' property to find out possible
             * issue because of which request did fail.
             *
             * Request can be resent using: [status retry]
             */
        }
    });

Response objects which is returned by client when manage memberships Object API is used:

@interface PNManageMembershipsData : PNServiceData

// List of updated memberships.
@property (nonatomic, readonly, strong) NSArray<PNMembership *> *memberships;

// Cursor bookmark for fetching the next page.
@property (nonatomic, nullable, readonly, strong) NSString *next;

// Cursor bookmark for fetching the previous page.
@property (nonatomic, nullable, readonly, strong) NSString *prev;

/**
 * Total number of users created for current subscribe key.
 *
 * Value will be 0 in case if 'includeCount' of PNManageMembershipsRequest is set to 'NO'.
 */
@property (nonatomic, readonly, assign) NSUInteger totalCount;

@end
 
 
@interface PNManageMembershipsStatus : PNAcknowledgmentStatus

// Manage memberships request processed information.
@property (nonatomic, readonly, strong) PNManageMembershipsData *data;

@end

Manage the specified space’s member users. You can Add, Remove, and Update a space's members.

To Manage Members you can use the following method(s) in the Objective-C SDK:
  1. ParameterTypeRequiredDescription
    requestPNManageMembersRequestYesManage space's members list request with information what modifications to space's members list should be done (add / update / remove users).
    blockPNManageMembersCompletionBlockNoManage space's members list request completion block.
    ParameterTypeRequiredDescription
    includeFieldsPNMemberFieldsNoBitfield set to fields which should be returned with response.
    • PNMemberCustomField - field with additional information which has been associated with user during add / update space's users list requests.
    • PNMemberUserField - field with user's information (not only userId).
    • PNMemberUserCustomField - field with additional information which has been used during user create / update requests.

    Omit this property if you don't want to retrieve additional attributes.
    addMembersNSArrayNoList of users which should be added to space's members list.
    Each entry is dictionary with userId and optional custom fields. custom should be dictionary with simple objects: NSString and NSNumber.
    updateMembersNSArrayNoList of users for which additional information associated with each of them in context of space should be updated.
    Each entry is dictionary with userId and optional custom fields. custom should be dictionary with simple objects: NSString and NSNumber.
    includeCountBOOLNoSet to YES to return the total number of members included in the paginated response.
    Default is NO.
    startNSStringNoThe previously-returned cursor bookmark to fetch the next page of results.
    endNSStringNoThe previously-returned cursor bookmark to fetch the previous page of results.
    limitNSUIntegerNoThe number of members to be returned in the response.
    Default is 100.
    spaceIdNSStringYesIdentifier of space for which members list should be updated.
PNManageMembersRequest *request = [PNManageMembersRequest requestWithSpaceID:@"space-uuid"];
request.updateMembers = @[
    @{ @"userId": @"user2-uuid", @"custom": @{ @"role": @"moderator" } }
];
request.removeMembers = @[@"user3-uuid", @"user4-uuid"];
request.addMembers = @[
    @{ @"userId": @"user1-uuid", @"custom": @{ @"role": @"owner" } }
];
// Add this request option, if returned member models should have value set to 'custom' and
// 'user' properties.
request.includeFields = PNMemberCustomField|PNMemberUserField;
request.includeCount = YES;
request.limit = 40;

[self.client manageMembersWithRequest:request completion:^(PNManageMembersStatus *status) {
    if (!status.isError) {
        /**
         * Space's members successfully updated.
         * Result object has following information:
         *   result.data.members - list of added / updated space's members
         *   result.data.next - cursor bookmark for fetching the next page
         *   result.data.prev - cursor bookmark for fetching the previous page
         *   result.data.totalCount - total number of space's memebers
         */
    } else {
        /**
         * Handle space's members update error. Check 'category' property to find out possible
         * issue because of which request did fail.
         *
         * Request can be resent using: [status retry]
         */
    }
}];

Response objects which is returned by client when manage members Object API is used:

@interface PNManageMembersData : PNServiceData

// List of updated members.
@property (nonatomic, readonly, strong) NSArray<PNMember *> *members;

// Cursor bookmark for fetching the next page.
@property (nonatomic, nullable, readonly, strong) NSString *next;

// Cursor bookmark for fetching the previous page.
@property (nonatomic, nullable, readonly, strong) NSString *prev;

/**
 * Total number of users created for current subscribe key.
 *
 * Value will be 0 in case if 'includeCount' of PNManageMembersRequest is set to 'false'.
 */
@property (nonatomic, readonly, assign) NSUInteger totalCount;

@end
 
 
@interface PNManageMembersStatus : PNAcknowledgmentStatus

// Manage members request processed information.
@property (nonatomic, readonly, strong) PNManageMembersData *data;

@end

Update the specified space’s member users. You can Add, Remove, and Update a space's members.

To Update Members you can use the following method(s) in the Objective-C SDK:
  1. ParameterTypeRequiredDescription
    spaceIdNSStringYesIdentifier of space for which members list should be updated.
    addNSArrayNoList of users which should be added to space's members list.
    Each entry is dictionary with userId and optional custom fields. custom should be dictionary with simple objects: NSString and NSNumber.
    updateNSArrayNoList of users for which additional information associated with each of them in context of space should be updated.
    Each entry is dictionary with userId and optional custom fields. custom should be dictionary with simple objects: NSString and NSNumber.
    removeNSArrayNoList of users (their identifiers) which should be removed from members list.
    includeFieldsPNMemberFieldsNo
    • PNMemberCustomField - field with additional information which has been associated with user during add / update space's users list requests.
    • PNMemberUserField - field with user's information (not only userId).
    • PNMemberUserCustomField - field with additional information which has been used during user create / update requests.
    includeCountBOOLNoSet to YES to return the total number of members included in the paginated response.
    Default is NO.
    limitNSUIntegerNoThe number of members to be returned in the response.
    Default is 100.
    startNSStringNoThe previously-returned cursor bookmark to fetch the next page of results.
    endNSStringNoThe previously-returned cursor bookmark to fetch the previous page of results.
    blockPNManageMembersCompletionBlockNoManage space's members list request completion block.
     
    This method uses the builder pattern, you can remove the arguments which are optional.
self.client.manageMembers()
    .spaceId(@"space-uuid")
    .update(@[
        @{ @"userId": @"user2-uuid", @"custom": @{ @"role": @"moderator" } }
    ])
    .remove(@[@"user3-uuid", @"user4-uuid"])
    .add(@[
        @{ @"userId": @"user1-uuid", @"custom": @{ @"role": @"owner" } }
    ])
    .includeCount(YES)
    .limit(40)
    .includeFields(PNMemberCustomField|PNMemberUserField)
    .performWithCompletion(^(PNManageMembersStatus *status) {
        if (!status.isError) {
            /**
             * Space's members successfully updated.
             * Result object has following information:
             *   result.data.members - list of added / updated space's members
             *   result.data.next - cursor bookmark for fetching the next page
             *   result.data.prev - cursor bookmark for fetching the previous page
             *   result.data.totalCount - total number of space's memebers
             */
        } else {
            /**
             * Handle space's members update error. Check 'category' property to find out possible
             * issue because of which request did fail.
             *
             * Request can be resent using: [status retry]
             */
        }
    });

Response objects which is returned by client when manage members Object API is used:

@interface PNManageMembersData : PNServiceData

// List of updated members.
@property (nonatomic, readonly, strong) NSArray<PNMember *> *members;

// Cursor bookmark for fetching the next page.
@property (nonatomic, nullable, readonly, strong) NSString *next;

// Cursor bookmark for fetching the previous page.
@property (nonatomic, nullable, readonly, strong) NSString *prev;

/**
 * Total number of users created for current subscribe key.
 *
 * Value will be 0 in case if 'includeCount' of PNManageMembersRequest is set to 'false'.
 */
@property (nonatomic, readonly, assign) NSUInteger totalCount;

@end
 
 
@interface PNManageMembersStatus : PNAcknowledgmentStatus

// Manage members request processed information.
@property (nonatomic, readonly, strong) PNManageMembersData *data;

@end