Official Initial State .Net Events API Client.
This package is hosted on nuget.
PM> Install-Package initialstate-client-net
Let's say you want to stream a telemetry measurement stored in a POCO like this:
class Telemetry {
public int Heading { get; set; }
public double Speed { get; set; }
public string Status { get; set; }
}
var telemetry = new Telemetry {
Heading = 270,
Speed = 38.29,
Status = "Normal"
};
You can stream this telemetry event simply using the InitialStateClient
// setup a configuration (most imporatant property is AccessKey)
var config = new InitialStateConfig {
AccessKey = "ist_youraccesskey"
};
var bucketKey = "my_telemetry";
// instantiate an InitialStateEventsClient and inject a configuration
var initialStateEventsClient = new InitialStateEventsClient(config);
// create a bucket
initialStateEventsClient.CreateBucket(bucketKey, bucketName: "My Telemetry Bucket");
// send the events from the Telemetry POCO
initialStateEventsClient.SendEvents(telemetry, bucketKey: "my_telemetry");
Or perhaps you want to send a single measurement without object complexity
// send a single coordinates event
initialStateEventsClient.SendEvent(key: "location", value: "36.174465,-86.767960");