public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { var o = JObject.Load(reader); var profileId = o.Value<string>("ProfileId"); var startDate = o.Value<DateTime>("StartDate"); var endDate = o.Value<DateTime>("EndDate"); var metrics = o["Metrics"].ToObject<string[]>().ToArray(); var dimensions = o["Dimensions"].ToObject<string[]>().ToArray(); var filter = o.Value<string>("Filter"); var sort = o.Value<string>("Sort"); var segment = o.Value<string>("Segment"); var maxResults = o.Value<int>("MaxResults"); var r = new GoogleAnalyticsRequestConfigurer(); r .WithProfileId(profileId) .ForDateRange(startDate, endDate) .WithMetrics(metrics) .WithDimensions(dimensions) .Custom(c => c .Filter(filter) .Sort(sort) .Segment(segment) .MaxResults(maxResults) ); return r.Build(); }
public async Task<IGoogleAnalyticsResponse> QueryAsync( Func<IGoogleAnalyticsRequestConfigurerProfileId, IGoogleAnalyticsRequestConfigurerProfileId> configurer) { var config = new GoogleAnalyticsRequestConfigurer(); configurer(config); return await QueryAsync(config.Build()); }
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) { var o = JObject.Load(reader); var profileId = o.Value <string>("ProfileId"); var startDate = o.Value <DateTime>("StartDate"); var endDate = o.Value <DateTime>("EndDate"); var metrics = o["Metrics"].ToObject <string[]>().ToArray(); var dimensions = o["Dimensions"].ToObject <string[]>().ToArray(); var filter = o.Value <string>("Filter"); var sort = o.Value <string>("Sort"); var segment = o.Value <string>("Segment"); var maxResults = o.Value <int>("MaxResults"); var r = new GoogleAnalyticsRequestConfigurer(); r .WithProfileId(profileId) .ForDateRange(startDate, endDate) .WithMetrics(metrics) .WithDimensions(dimensions) .Custom(c => c .Filter(filter) .Sort(sort) .Segment(segment) .MaxResults(maxResults) ); return(r.Build()); }
public IGoogleAnalyticsResponse Query( Func<IGoogleAnalyticsRequestConfigurerProfileId, IGoogleAnalyticsRequestConfigurerProfileId> configurer) { var config = new GoogleAnalyticsRequestConfigurer(); configurer(config); return Query(config.Build()); }