public Task DeleteEventAsync(string key, string eventType, DateTimeOffset timestamp, long ordinal)
        {
            Guard.ArgumentNotNullOrEmpty(nameof(key), key);
            Guard.ArgumentNotNullOrEmpty(nameof(eventType), eventType);

            HttpUrlBuilder uri = new HttpUrlBuilder(host)
                                 .AppendPath(CollectionName)
                                 .AppendPath(key)
                                 .AppendPath("events")
                                 .AppendPath(eventType)
                                 .AppendPath(UnixTime.FromDateTimeOffset(timestamp).ToString())
                                 .AppendPath(ordinal.ToString())
                                 .AddQuery("purge", "true");

            return(restClient.SendAsync(uri, HttpMethod.Delete));
        }
        public async Task <EventMetaData> AddEventAsync <T>(string key, string eventType, T @event, DateTimeOffset?timestamp = null)
        {
            Guard.ArgumentNotNullOrEmpty(nameof(key), key);
            Guard.ArgumentNotNullOrEmpty(nameof(eventType), eventType);
            Guard.ArgumentNotNull(nameof(@event), @event);

            HttpUrlBuilder uri = new HttpUrlBuilder(host)
                                 .AppendPath(CollectionName)
                                 .AppendPath(key)
                                 .AppendPath("events")
                                 .AppendPath(eventType);

            if (timestamp.HasValue)
            {
                uri.AppendPath(UnixTime.FromDateTimeOffset(timestamp.Value).ToString());
            }

            var response = await restClient.SendAsync(uri, HttpMethod.Post, @event);

            return(EventMetaData.Make(response));
        }
 public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
 {
     writer.WriteValue(UnixTime.FromDateTimeOffset((DateTimeOffset)value).Value);
 }