Inherits from NSObject
Declared in APConnection.h
APConnection.m

Overview

A Connection is represents an edge in a graph and is used to connect two APObjects. A Connection itself can store data in its properties and attributes fields.

Tasks

Getting the APConnection

Searching for APConnections

Create APConnections

Update APConnections

Fetch APConnections

Delete APConnections

Methods to store key-value pairs

Class Methods

connectionWithRelationType:

Initialize and return an APConnection for the provided relation type.

+ (id)connectionWithRelationType:(NSString *)relationType

Parameters

relationType

The name of the relation. This is specified while creating the schema.

Declared In

APConnection.h

deleteConnectionsWithRelationType:objectIds:

+ (void)deleteConnectionsWithRelationType:(NSString *)relationType objectIds:(NSArray *)objectIds

Declared In

APConnection.h

deleteConnectionsWithRelationType:objectIds:failureHandler:

+ (void)deleteConnectionsWithRelationType:(NSString *)relationType objectIds:(NSArray *)objectIds failureHandler:(APFailureBlock)failureBlock

Declared In

APConnection.h

deleteConnectionsWithRelationType:objectIds:successHandler:failureHandler:

Deletes multiple APConnections.

+ (void)deleteConnectionsWithRelationType:(NSString *)relationType objectIds:(NSArray *)objectIds successHandler:(APSuccessBlock)successBlock failureHandler:(APFailureBlock)failureBlock

Parameters

relationType

The name of the relation. Connections of this relation name will be deleted.

objectIds

An array of objectIds. APConnections having these object ids will be deleted.

successBlock

Block invoked when the delete call is successful.

failureBlock

Block invoked when the delete call fails.

Declared In

APConnection.h

fetchConnectionWithRelationType:objectId:successHandler:

+ (void)fetchConnectionWithRelationType:(NSString *)relationType objectId:(NSNumber *)objectId successHandler:(APResultSuccessBlock)successBlock

Declared In

APConnection.h

fetchConnectionWithRelationType:objectId:successHandler:failureHandler:

Fetch an APConnection of a particular relation type.

+ (void)fetchConnectionWithRelationType:(NSString *)relationType objectId:(NSNumber *)objectId successHandler:(APResultSuccessBlock)successBlock failureHandler:(APFailureBlock)failureBlock

Parameters

relationType

The name of the relation. A connection of this relation name is retrieved.

objectId

The id of the connection to retrieve.

successBlock

Block invoked when the fetch call is successful. The block returns the results in the form of a JSON.

failureBlock

Block invoked when the fetch call operation fails.

Declared In

APConnection.h

fetchConnectionsWithRelationType:objectIds:successHandler:

fetchConnectionsWithRelationType:objectId:successHandler:failureHandler:

+ (void)fetchConnectionsWithRelationType:(NSString *)relationType objectIds:(NSArray *)objectIds successHandler:(APResultSuccessBlock)successBlock

Declared In

APConnection.h

fetchConnectionsWithRelationType:objectIds:successHandler:failureHandler:

Fetches multiple APConnections from the remote server.

+ (void)fetchConnectionsWithRelationType:(NSString *)relationType objectIds:(NSArray *)objectIds successHandler:(APResultSuccessBlock)successBlock failureHandler:(APFailureBlock)failureBlock

Parameters

relationType

The name of the relation. Connections of this relation are retrieved.

objectIds

An array of objectIds. Connections with these object ids are fetched.

successBlock

Block invoked when the fetch call is successful. The block returns the results in the form of a JSON.

failureBlock

Block invoked when the fetch call operation fails.

Declared In

APConnection.h

searchAllConnectionsFromObjectId:toObjectIds:

+ (void)searchAllConnectionsFromObjectId:(NSNumber *)objectId toObjectIds:(NSArray *)objectIds

Declared In

APConnection.h

searchAllConnectionsFromObjectId:toObjectIds:withSuccessHandler:

+ (void)searchAllConnectionsFromObjectId:(NSNumber *)objectId toObjectIds:(NSArray *)objectIds withSuccessHandler:(APResultSuccessBlock)successBlock

Declared In

APConnection.h

searchAllConnectionsFromObjectId:toObjectIds:withSuccessHandler:failureHandler:

Searches for Connections between the single article and any of the articles in the list and returns the paginated list of all connections .

+ (void)searchAllConnectionsFromObjectId:(NSNumber *)objectId toObjectIds:(NSArray *)objectIds withSuccessHandler:(APResultSuccessBlock)successBlock failureHandler:(APFailureBlock)failureBlock

Parameters

objectId

The id of the APObject for which the connections are to be retrieved.

successBlock

Block invoked when the search call is successful.

failureBlock

Block invoked when the search call fails.

objectsId

An array of objectIds.

Declared In

APConnection.h

searchForAllConnectionsWithRelationType:successHandler:

+ (void)searchForAllConnectionsWithRelationType:(NSString *)relationType successHandler:(APResultSuccessBlock)successBlock

Declared In

APConnection.h

searchForAllConnectionsWithRelationType:successHandler:failureHandler:

Search for all APConnections of a particular relation type.

+ (void)searchForAllConnectionsWithRelationType:(NSString *)relationType successHandler:(APResultSuccessBlock)successBlock failureHandler:(APFailureBlock)failureBlock

Parameters

relationType

The relation type that the connections should belong to.

successBlock

Block invoked when the search call is successful.

failureBlock

Block invoked when the search call fails.

Declared In

APConnection.h

searchForConnectionsWithRelationType:withQueryString:successHandler:

+ (void)searchForConnectionsWithRelationType:(NSString *)relationType withQueryString:(NSString *)queryString successHandler:(APResultSuccessBlock)successBlock

Declared In

APConnection.h

searchForConnectionsWithRelationType:withQueryString:successHandler:failureHandler:

Searches for APConnections and filters the result according to the query provided.

+ (void)searchForConnectionsWithRelationType:(NSString *)relationType withQueryString:(NSString *)queryString successHandler:(APResultSuccessBlock)successBlock failureHandler:(APFailureBlock)failureBlock

Parameters

relationType

The relation type that the connections should belong to.

queryString

SQL kind of query to search for specific objects. For more info http://appacitive.com

successBlock

Block invoked when the search call is successful.

failureBlock

Block invoked when the search call fails.

Declared In

APConnection.h

Instance Methods

addAttributeWithKey:value:

Method used to add an attibute to the APObject. Attributes are used to store extra information.

- (void)addAttributeWithKey:(NSString *)keyName value:(id)object

Parameters

keyName

key of the data item to be stored.

object

Corresponding value to the key.

Declared In

APConnection.h

addPropertyWithKey:value:

Method used to add a property to the APObject.

- (void)addPropertyWithKey:(NSString *)keyName value:(id)object

Parameters

keyName

key of the data item to be stored.

object

Corresponding value to the key.

Declared In

APConnection.h

createConnectionWithFailureHandler:

- (void)createConnectionWithFailureHandler:(APFailureBlock)failureBlock

Declared In

APConnection.h

createConnectionWithObjectA:objectB:

- (void)createConnectionWithObjectA:(APObject *)objectA objectB:(APObject *)objectB

Declared In

APConnection.h

createConnectionWithObjectA:objectB:failureHandler:

- (void)createConnectionWithObjectA:(APObject *)objectA objectB:(APObject *)objectB failureHandler:(APFailureBlock)failureBlock

Declared In

APConnection.h

createConnectionWithObjectA:objectB:labelA:labelB:

- (void)createConnectionWithObjectA:(APObject *)objectA objectB:(APObject *)objectB labelA:(NSString *)labelA labelB:(NSString *)labelB

Declared In

APConnection.h

createConnectionWithObjectA:objectB:labelA:labelB:failureHandler:

- (void)createConnectionWithObjectA:(APObject *)objectA objectB:(APObject *)objectB labelA:(NSString *)labelA labelB:(NSString *)labelB failureHandler:(APFailureBlock)failureBlock

Declared In

APConnection.h

createConnectionWithObjectA:objectB:labelA:labelB:successHandler:failureHandler:

Creates an APConnection between two APObjects. The labels on either side of the connection are specified as parameters.

- (void)createConnectionWithObjectA:(APObject *)objectA objectB:(APObject *)objectB labelA:(NSString *)labelA labelB:(NSString *)labelB successHandler:(APSuccessBlock)successBlock failureHandler:(APFailureBlock)failureBlock

Parameters

objectA

The article to create a connection from.

objectB

The article to create a connection to.

labelA

The label at the starting vertex of the connection.

successBlock

Block invoked when the create operation is successful.

failureBlock

Block invoked when the create operation fails.

lablelB

The label at the end vertex of the connection.

Declared In

APConnection.h

createConnectionWithObjectA:objectB:successHandler:failureHandler:

Creates an APConnection between two APObjects.

- (void)createConnectionWithObjectA:(APObject *)objectA objectB:(APObject *)objectB successHandler:(APSuccessBlock)successBlock failureHandler:(APFailureBlock)failureBlock

Parameters

objectA

The article to create a connection from.

objectB

The article to create a connection to.

successBlock

Block invoked when the create operation is successful.

failureBlock

Block invoked when the create operation fails.

Discussion

This method will set labelA and labelB as the schemaName of objectA and objectB.

Declared In

APConnection.h

createConnectionWithObjectAId:objectBId:labelA:labelB:

- (void)createConnectionWithObjectAId:(NSNumber *)objectAId objectBId:(NSNumber *)objectBId labelA:(NSString *)labelA labelB:(NSString *)labelB

Declared In

APConnection.h

createConnectionWithObjectAId:objectBId:labelA:labelB:failureHandler:

- (void)createConnectionWithObjectAId:(NSNumber *)objectAId objectBId:(NSNumber *)objectBId labelA:(NSString *)labelA labelB:(NSString *)labelB failureHandler:(APFailureBlock)failureBlock

Declared In

APConnection.h

createConnectionWithObjectAId:objectBId:labelA:labelB:successHandler:failureHandler:

Creates an APConnection between two APObjects.

- (void)createConnectionWithObjectAId:(NSNumber *)objectAId objectBId:(NSNumber *)objectBId labelA:(NSString *)labelA labelB:(NSString *)labelB successHandler:(APSuccessBlock)successBlock failureHandler:(APFailureBlock)failureBlock

Parameters

objectAId

The id of the APObject to create a connection from.

objectBId

The id of the APObject to create a connection to.

labelA

The label at the starting vertex of the connection.

labelB

The label at the end vertex of the connection.

failureHandler

Block invoked when the create operation fails.

successHandler

Block invoked when the create operation is successful.

Declared In

APConnection.h

createConnectionWithSuccessHandler:failureHandler:

Create an APConnection between two APObjects on the remote server.

- (void)createConnectionWithSuccessHandler:(APSuccessBlock)successBlock failureHandler:(APFailureBlock)failureBlock

Parameters

successBlock

Block invoked when the create operation is successful.

failureBlock

Block invoked when the create operation fails.

Discussion

This method requires the articleAId, articleBId, labelA and labelB properties to be set.

Declared In

APConnection.h

deleteConnection

- (void)deleteConnection

Declared In

APConnection.h

deleteConnectionWithFailureHandler:

- (void)deleteConnectionWithFailureHandler:(APFailureBlock)failureBlock

Declared In

APConnection.h

deleteConnectionWithSuccessHandler:failureHandler:

Deletes an APConnection.

- (void)deleteConnectionWithSuccessHandler:(APSuccessBlock)successBlock failureHandler:(APFailureBlock)failureBlock

Parameters

successBlock

Block invoked when delete is successful.

failureBlock

Block invoked when delete fails.

Discussion

This method requires the relationType and objectId to be set.

Declared In

APConnection.h

fetchConnection

- (void)fetchConnection

Declared In

APConnection.h

fetchConnectionWithFailureHandler:

- (void)fetchConnectionWithFailureHandler:(APFailureBlock)failureBlock

Declared In

APConnection.h

fetchConnectionWithSuccessHandler:failureHandler:

Fetch a connection. This method will use the objectId property to fetch the connecition.

- (void)fetchConnectionWithSuccessHandler:(APSuccessBlock)successBlock failureHandler:(APFailureBlock)failureBlock

Parameters

successBlock

Block invoked when the connection is fetched

failureBlock

Block invoked when the fetch call fails

Declared In

APConnection.h

getPropertyWithKey:

Method used to retrieve a property using its key.

- (id)getPropertyWithKey:(NSString *)keyName

Parameters

keyName

key of the date item to be removed.

Declared In

APConnection.h

initWithRelationType:

Initialize and return an APConnection for the provided relation type.

- (id)initWithRelationType:(NSString *)relationType

Parameters

relationType

The name of the relation. This is specified while creating the schema.

Declared In

APConnection.h

removeAttributeWithKey:

Method used to remove an attribute. Call update after this method call to persist the change

- (void)removeAttributeWithKey:(NSString *)keyName

Parameters

keyName

key of the attribute to be removed.

Declared In

APConnection.h

removePropertyWithKey:

Method used to delete a property. Call update after this method call to persist the change.

- (void)removePropertyWithKey:(NSString *)keyName

Parameters

keyName

key of the data item to be removed.

Declared In

APConnection.h

updateAttributeWithKey:value:

Method used to update an attribute. Call update after this method call to persist the change

- (void)updateAttributeWithKey:(NSString *)keyName value:(id)object

Parameters

keyName

key of the attribute to be updated.

object

Corresponding value to the key.

Declared In

APConnection.h

updateConnection

- (void)updateConnection

Declared In

APConnection.h

updateConnectionWithFailureHandler:

- (void)updateConnectionWithFailureHandler:(APFailureBlock)failureBlock

Declared In

APConnection.h

updateConnectionWithSuccessHandler:failureHandler:

Method used to update an APConnection.

- (void)updateConnectionWithSuccessHandler:(APSuccessBlock)successBlock failureHandler:(APFailureBlock)failureBlock

Parameters

successBlock

Block invoked when the update operation is successful.

failureBlock

Block invoked when the update operation fails.

Declared In

APConnection.h

updatePropertyWithKey:value:

Method used to update an existing property. Call update after this method call to persist the update.

- (void)updatePropertyWithKey:(NSString *)keyName value:(id)object

Parameters

keyName

key of the data item to be updated.

object

Corresponding value to the key.

Declared In

APConnection.h