.NET Library for Orchestrate
PM> Install-Package Orchestrate.NET
Orchestrate.NET runs against the actual Orchestrate API. Go to Orchestrate.io and set up an account. Create a new application and use the API key provided.
Please refer to the docs at orchestrate.io for more details.
var orchestrate = new Orchestrate.Net.Orchestrate(api key);
Creating a collection requires an object to be placed in the collection. No empty collections allowed.
var collection = orchestrate.Put(collectionName, key, object
);
or you can pass in a json string:
var collection = orchestrate.Put(collectionName, key, json
);
You can retrieve items by key with the Get method:
Result result = orchestrate.Get(collectionName, key);
var item = result.Value;
You can add items to your collection with the Post command. This will add the item and generate a unique key:
Result result = orchestrate.Post(collectionName, object
);
or use a json string:
Result result = orchestrate.Post(collectionName, json
);
You can add/update items to your collection via the Put method. This will not create a new key, but use the one provided:
Result result = orchestrate.Put(collectionName, key, object
);
or you can pass in a json string:
var collection = orchestrate.Put(collectionName, key, json
);
Searching a collection is as simple as defining a Lucene query string. (http://lucene.apache.org/core/4_3_0/queryparser/org/apache/lucene/queryparser/classic/package-summary.html#Overview)
SearchResult result = orchestrate.Search(collectionName, query, limit, offset);
Are all supported, see the docs on the Orchestrate.io website for details.
For running tests follow either of the approaches
-
update the
app.config
file in the pathOrchestrate.Net.Tests/
and replace YOUR-API-KEY-GOES-HERE with your api key (remember to unset this value before you commit/push your code to repository). -
set the environment variable
OrchestrateApiKey
value to match your api key (if you set this after you have opened Visual Studio, please restart Visual Studio, otherwise the environment variable will not be available).
If both the above settings are set, then the value set in environment variable will be used.