|
|
C# APIFrom $1Table of contentsVersion: 0.1.0 (Note: Versions are Major.Minor.Revision, where Major.Minor mirror the version of the REST API that the API adapts, while Revision indicates updates to the current implementation) OverviewThe C# API implements a fluent api for calling the REST API. It is based on data objects being sent and retrieved from the server via call constructs. I.e. in order to match the document driven interface of REST, this API opts for a more functional approach of operations on data, rather than data objects encapsulating the actions that can be performed on them. Creating a Session// using accountId/pass from app.config ISession session = SessionFactory.Login(); // directly providing accountId/pass ISession session = SessionFactory.Login(accountId, password); Create a new Source//using fluent api for source definition
ISource source = session.Sources().BuildNew()
.Name("test source")
.Uri("http://reference/uri")
.Create();
// creating a new source object with a given id, initializing and saving it
ISource newSource = session.Sources().New("abcd");
newSource.Name = "test source";
newSource.Uri = new XUri("http://reference/uri");
ISource savedSource = session.Sources().Save(newSource);
Retrieve and update existing SourceISource source = session.Sources.Get("abcd");
source.Name = "Updated Name";
ISource savedSource = session.Sources().Save(source);
Delete an existing Source// delete by id
session.Sources().Delete("abcd");
// delete given an instance
session.Sources().Delete(source);
Post a new notification against a SourceINotification notification = session.Source(source).Notifications().BuildNew()
.Subject("hello world")
.Uri("http://somehost/hello/world")
.Create();
Tags:
|
.Subject("hello world")
.Uri("http://somehost/hello/world")
.Create();