Added connections to readme

Project: http://git-wip-us.apache.org/repos/asf/usergrid-nodejs/repo
Commit: http://git-wip-us.apache.org/repos/asf/usergrid-nodejs/commit/3ffee11e
Tree: http://git-wip-us.apache.org/repos/asf/usergrid-nodejs/tree/3ffee11e
Diff: http://git-wip-us.apache.org/repos/asf/usergrid-nodejs/diff/3ffee11e

Branch: refs/heads/master
Commit: 3ffee11e80df4903e118fc39dec4bde11e4ae5db
Parents: 05758e0
Author: brandon <bran...@behemoth.ca>
Authored: Wed Feb 10 09:21:31 2016 -0800
Committer: brandon <bran...@behemoth.ca>
Committed: Wed Feb 10 09:21:31 2016 -0800

----------------------------------------------------------------------
 README.md | 44 ++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 40 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/usergrid-nodejs/blob/3ffee11e/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 7a83136..c16bd7e 100644
--- a/README.md
+++ b/README.md
@@ -75,7 +75,7 @@ The Usergrid Node.js SDK is built on top of 
[request](https://github.com/request
 
 When making any RESTful call, a `type` parameter (or `path`) is always 
required. Whether you specify this as an argument or in an object as a 
parameter is up to you.
 
-### GET requests
+### GET
 
 **GET entities in a collection**
 
@@ -106,7 +106,7 @@ When making any RESTful call, a `type` parameter (or 
`path`) is always required.
         // entities is an array of UsergridEntity objects matching the 
specified query
     })
     
-### POST and PUT requests
+### POST and PUT
 
 POST and PUT requests both require a JSON body payload. You can pass either a 
standard JavaScript object or a `UsergridEntity` instance. While the former 
works in principle, best practise is to use a `UsergridEntity` wherever 
practical. When an entity has a uuid or name property and already exists on the 
server, use a PUT request to update it. If it does not, use POST to create it.
 
@@ -196,7 +196,7 @@ POST and PUT requests both require a JSON body payload. You 
can pass either a st
         /*
     })
     
-### DELETE requests
+### DELETE
 
 DELETE requests require either a specific entity or a `UsergridQuery` object 
to be passed as an argument.
     
@@ -243,7 +243,7 @@ DELETE requests require either a specific entity or a 
`UsergridQuery` object to
         // entity is now deleted on the server and the local instance should 
be destroyed
     })
 
-## UsergridResponse
+## UsergridResponse object
 
 `UsergridResponse` implements several Usergrid-specific enhancements to 
[request](https://github.com/request/request). Notably:
 
@@ -300,6 +300,42 @@ Examples:
         //     usergridResponse.user
     })
     
+## Connections
+
+Connections can be managed using `Usergrid.connect()`, 
`Usergrid.disconnect()`, and `Usergrid.getConnections()`, or entity convenience 
methods of the same name.
+
+### connect
+
+**Create a connection between two entities**
+
+    Usergrid.connect(entity1, 'relationship', entity2, function(err, 
usergridResponse) {
+        // entity1 now has an outbound connection to entity2
+    })
+    
+### getConnections
+
+**Retrieve outbound connections**
+
+    client.getConnections(UsergridClient.Connections.DIRECTION_OUT, entity1, 
'relationship', function(err, usergridResponse, entities) {
+        // entities is an array of entities that entity1 is connected to via 
'relationship'
+        // in this case, we'll see entity2 in the array
+    })
+    
+**Retrieve inbound connections**
+
+    client.getConnections(UsergridClient.Connections.DIRECTION_IN, entity2, 
'relationship', function(err, usergridResponse, entities) {
+        // entities is an array of entities that connect to entity2 via 
'relationship'
+        // in this case, we'll see entity1 in the array
+    })
+    
+### disconnect
+
+**Delete a connection between two entities**
+
+    Usergrid.disconnect(entity1, 'relationship', entity2, function(err, 
usergridResponse) {
+        // entity1's outbound connection to entity2 has been destroyed
+    })
+    
 ## Assets
 
 Assets can be uploaded and downloaded either directly using `Usergrid.POST` or 
`Usergrid.PUT`, or via `UsergridEntity` convenience methods. Before uploading 
an asset, you will need to initialize a `UsergridAsset` instance.

Reply via email to