Skip to content

Commit

Permalink
Whitspace cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
myagley committed Jan 25, 2013
1 parent fbfe1bb commit 26dda05
Show file tree
Hide file tree
Showing 11 changed files with 675 additions and 677 deletions.
678 changes: 339 additions & 339 deletions Client/Client.cs

Large diffs are not rendered by default.

100 changes: 50 additions & 50 deletions Client/JsonSerializer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,53 +8,53 @@
namespace Client
{

public class JsonDeserializer : IDeserializer
{
public T Deserialize<T>(IRestResponse response)
{
return JsonConvert.DeserializeObject<T>(response.Content);
}

public string RootElement { get; set; }
public string Namespace { get; set; }
public string DateFormat { get; set; }
}


public class JsonSerializer : ISerializer
{
public JsonSerializer()
{
ContentType = "application/json";
}

public string Serialize(object obj)
{
return JsonConvert.SerializeObject(obj, new TempoDateTimeConvertor());
}

public string RootElement { get; set; }
public string Namespace { get; set; }
public string DateFormat { get; set; }
public string ContentType { get; set; }
}

public class TempoDateTimeConvertor : DateTimeConverterBase
{

public override void WriteJson(JsonWriter writer, object value, Newtonsoft.Json.JsonSerializer serializer)
{
writer.WriteValue(ConvertDateTimeToString(value));
}

public static string ConvertDateTimeToString(object value)
{
return ((DateTime)value).ToString("yyyy-MM-ddTHH:mm:ss.fffzzz");
}

public override object ReadJson(JsonReader reader, Type objectType, object existingValue, Newtonsoft.Json.JsonSerializer serializer)
{
return DateTime.Parse(reader.Value.ToString());
}
}
}
public class JsonDeserializer : IDeserializer
{
public T Deserialize<T>(IRestResponse response)
{
return JsonConvert.DeserializeObject<T>(response.Content);
}

public string RootElement { get; set; }
public string Namespace { get; set; }
public string DateFormat { get; set; }
}


public class JsonSerializer : ISerializer
{
public JsonSerializer()
{
ContentType = "application/json";
}

public string Serialize(object obj)
{
return JsonConvert.SerializeObject(obj, new TempoDateTimeConvertor());
}

public string RootElement { get; set; }
public string Namespace { get; set; }
public string DateFormat { get; set; }
public string ContentType { get; set; }
}

public class TempoDateTimeConvertor : DateTimeConverterBase
{

public override void WriteJson(JsonWriter writer, object value, Newtonsoft.Json.JsonSerializer serializer)
{
writer.WriteValue(ConvertDateTimeToString(value));
}

public static string ConvertDateTimeToString(object value)
{
return ((DateTime)value).ToString("yyyy-MM-ddTHH:mm:ss.fffzzz");
}

public override object ReadJson(JsonReader reader, Type objectType, object existingValue, Newtonsoft.Json.JsonSerializer serializer)
{
return DateTime.Parse(reader.Value.ToString());
}
}
}
39 changes: 20 additions & 19 deletions Client/Model/BulkDataSet.cs
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using Newtonsoft.Json;


namespace Client.Model
{

/// <summary>
/// Set of data to send for a bulk write. This encapsulates the timestamp and list of BulkPoints
/// </summary>
public class BulkDataSet
{
/// <param name="timestamp"> The timestamp to write the datapoints at </param>
/// <param name="data"> A list of BulkPoints to write </param>
/// <summary>
/// Set of data to send for a bulk write. This encapsulates the timestamp and list of BulkPoints
/// </summary>
public class BulkDataSet
{
/// <param name="timestamp"> The timestamp to write the datapoints at </param>
/// <param name="data"> A list of BulkPoints to write </param>

public BulkDataSet(DateTime timestamp, List<BulkPoint> data)
{
Timestamp = timestamp;
Data = data;
}
public BulkDataSet(DateTime timestamp, List<BulkPoint> data)
{
Timestamp = timestamp;
Data = data;
}

[JsonProperty(PropertyName = "t")]
public DateTime Timestamp { get; private set; }
[JsonProperty(PropertyName = "t")]
public DateTime Timestamp { get; private set; }

[JsonProperty(PropertyName = "data")]
public List<BulkPoint> Data { get; private set; }
}
}
[JsonProperty(PropertyName = "data")]
public List<BulkPoint> Data { get; private set; }
}
}
35 changes: 18 additions & 17 deletions Client/Model/BulkIdPoint.cs
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
using Newtonsoft.Json;


namespace Client.Model
{
/// <summary>
/// Represents a datapoint for a series referenced by id. This class is used to represent
/// datapoints in a bulk write.
/// </summary>
public class BulkIdPoint : BulkPoint
{
/// <param name="id"> The id of the Series </param>
/// <param name="value"> The datapoint value </param>
public BulkIdPoint(string id, double value)
{
Id = id;
Value = value;
}
/// <summary>
/// Represents a datapoint for a series referenced by id. This class is used to represent
/// datapoints in a bulk write.
/// </summary>
public class BulkIdPoint : BulkPoint
{
/// <param name="id"> The id of the Series </param>
/// <param name="value"> The datapoint value </param>
public BulkIdPoint(string id, double value)
{
Id = id;
Value = value;
}

[JsonProperty(PropertyName = "id")]
public string Id { get; private set; }
}
[JsonProperty(PropertyName = "id")]
public string Id { get; private set; }
}

}
}
35 changes: 18 additions & 17 deletions Client/Model/BulkKeyPoint.cs
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
using Newtonsoft.Json;


namespace Client.Model
{
/// <summary>
/// Represents a datapoint for a series referenced by id. This class is used to represent
/// datapoints in a bulk write.
/// </summary>
public class BulkKeyPoint : BulkPoint
{
/// <param name="key"> The key of the Series </param>
/// <param name="value"> The datapoint value </param>
public BulkKeyPoint(string key, double value)
{
Key = key;
Value = value;
}
/// <summary>
/// Represents a datapoint for a series referenced by id. This class is used to represent
/// datapoints in a bulk write.
/// </summary>
public class BulkKeyPoint : BulkPoint
{
/// <param name="key"> The key of the Series </param>
/// <param name="value"> The datapoint value </param>
public BulkKeyPoint(string key, double value)
{
Key = key;
Value = value;
}

[JsonProperty(PropertyName = "key")]
public string Key { get; private set; }
}
[JsonProperty(PropertyName = "key")]
public string Key { get; private set; }
}

}
}
26 changes: 13 additions & 13 deletions Client/Model/BulkPoint.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@

using Newtonsoft.Json;


namespace Client.Model
{
/// <summary>
/// The abstract parent class representing a datapoint used in a bulk write. Bulk
/// writing allows values for different series to be written for the same timestamp in one
/// Rest call. The series can be referenced by series id or series key. The two subclasses
/// represent these two options.
/// </summary>
/// <summary>
/// The abstract parent class representing a datapoint used in a bulk write. Bulk
/// writing allows values for different series to be written for the same timestamp in one
/// Rest call. The series can be referenced by series id or series key. The two subclasses
/// represent these two options.
/// </summary>

public abstract class BulkPoint
{
[JsonProperty(PropertyName = "v")]
public double Value { get; set; }
}
}
public abstract class BulkPoint
{
[JsonProperty(PropertyName = "v")]
public double Value { get; set; }
}
}
122 changes: 61 additions & 61 deletions Client/Model/Common.cs
Original file line number Diff line number Diff line change
@@ -1,63 +1,63 @@
namespace Client.Model
{
public static class FoldingFunction
{
public static readonly string Count = "count";
public static readonly string Max = "max";
public static readonly string Mean = "mean";
public static readonly string Min = "min";
public static readonly string StandardDeviation = "stddev";
public static readonly string Sum = "sum";
public static readonly string SumOfSquares = "ss";
}

public static class IntervalParameter
{
public static string Days(int days)
{
return string.Format("{0}day", days);
}

public static string Hours(int hours)
{
return string.Format("{0}hour", hours);
}

public static string Minutes(int minutes)
{
return string.Format("{0}min", minutes);
}

public static string Months(int months)
{
return string.Format("{0}month", months);
}

public static string Years(int years)
{
return string.Format("{0}year", years);
}

public static string Raw()
{
return "raw";
}

}

public static class SeriesProperty
{
public static readonly string Id = "id";
public static readonly string Key = "key";
}

public static class QueryStringParameter
{
public static readonly string Id = "id";
public static readonly string Key = "key";
public static readonly string Start = "start";
public static readonly string End = "end";
public static readonly string Function = "function";
public static readonly string Interval = "interval";
}
}
public static class FoldingFunction
{
public static readonly string Count = "count";
public static readonly string Max = "max";
public static readonly string Mean = "mean";
public static readonly string Min = "min";
public static readonly string StandardDeviation = "stddev";
public static readonly string Sum = "sum";
public static readonly string SumOfSquares = "ss";
}

public static class IntervalParameter
{
public static string Days(int days)
{
return string.Format("{0}day", days);
}

public static string Hours(int hours)
{
return string.Format("{0}hour", hours);
}

public static string Minutes(int minutes)
{
return string.Format("{0}min", minutes);
}

public static string Months(int months)
{
return string.Format("{0}month", months);
}

public static string Years(int years)
{
return string.Format("{0}year", years);
}

public static string Raw()
{
return "raw";
}

}

public static class SeriesProperty
{
public static readonly string Id = "id";
public static readonly string Key = "key";
}

public static class QueryStringParameter
{
public static readonly string Id = "id";
public static readonly string Key = "key";
public static readonly string Start = "start";
public static readonly string End = "end";
public static readonly string Function = "function";
public static readonly string Interval = "interval";
}
}
Loading

0 comments on commit 26dda05

Please sign in to comment.